// JavaScript Document
 
  $(document).ready(function(){   
  
   
     $('.zebra tbody tr:odd', this).removeClass('even').addClass('odd');
     $('.zebra tbody tr:even', this).removeClass('odd').addClass('even');

     /* Code for the suburbs stuff on the checkout page */
  
    
    /* Full Suburb list open and close */
    $("#full_list").hide();
    $("#show_full_list").click(function () {     
     $("#full_list").toggle();
     return false;
    });
    
    
        
    //$("#anz").removeAttr("disabled");    
    //$("#anz").attr("disabled","disabled");
    
    
        
      var submitted_suburb = $("#ship_city").val(); 
         
       //$.post('http://laptop1/waterfarms-ci/checkout/check_suburb',{suburb: submitted_suburb}, function(data)
       $.post('http://www.waterfarms.com.au/checkout/check_suburb',{suburb: submitted_suburb}, function(data)
          { 
            if(data == 1){             
              //$("#anz").attr("checked", "checked");            
              $("#anz").removeAttr("disabled");                          
            }
            else{
            
            //$("#phone").attr("checked", "checked");
            
            $("#anz").removeAttr('checked');
            $("#anz").attr("disabled","disabled");           
           
            }         
          });   

    
    
    
    
    
    
    
    
    
    
    
    
    
  
    $("#ship_city").change(function () {      
      var submitted_suburb = $(this).val();    
      // $.post('http://laptop1/waterfarms-ci/checkout/check_suburb',{suburb: submitted_suburb}, function(data)
      $.post('http://www.waterfarms.com.au/checkout/check_suburb',{suburb: submitted_suburb}, function(data)
          { 
            if(data == 1){             
              //$("#anz").attr("checked", "checked");
              alert('Great News: We can offer free delivery to your location.');  
              $("#anz").removeAttr("disabled");
                          
            }
            else{
            
            //$("#phone").attr("checked", "checked");
            
            $("#anz").removeAttr('checked');
            $("#anz").attr("disabled","disabled");           
            alert('Sorry, at this stage we do not offer free delivery to your area, please complete the order and we will find the most cost effective transportation solution for your water order.');
            }         
          });   
   });
   
   
  
   $("#delivery_same_copy").click(function () {    
      if($('#delivery_same_copy').is(':checked')){      
      var ship_business = $('#ship_business').val();      
      var ship_address1 = $('#ship_address1').val();
      var ship_state = $('#ship_state').val();
      var ship_city = $('#ship_city').val();
      var ship_zip = $('#ship_zip').val();         
      
      $('#business_name').val(ship_business);
      $('#address1').val(ship_address1);
      $('#state').val(ship_state);
      $('#city').val(ship_city);
      $('#zip').val(ship_zip);        
      }
      else{
      $('#busines_name').val('');
      $('#address1').val('');
      $('#state').val('');
      $('#city').val('');
      $('#zip').val('');     
      }
    });
});
  
