//google plus social icon
(function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/plusone.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
  })();



$(document).ready(function()  
{
	
	//homepage
	$(".btnbuy").click(function() 
	{
			var r = true;
		
			$(".attribute").each(function() 
			{
			
			if($(this).val() == '') 
			{
					$(this).css('border','2px solid red');
					r = false;
			}

			});
		
			return r;
	});
	
	$("#fld_shipping").change(function() 
	{
			
			$.ajaxSetup({
			    beforeSend: function() {
			        // TODO: show your spinner
			        $('.spinner').show();
			    },
			    complete: function() {
			        // TODO: hide your spinner
			        $('.spinner').hide();
			    }
			});
			
			
			
			
			
			
			$("div.checkout-group").css("display", "block");
			var addr_shipping = $(this).val();
			$.get("ajax.php", { shipping_id: addr_shipping },
			
		    	function(data)
				{	
					
						
						$("p.checkout-subtotal span").text("$" + data.purchase_subtotal);
			            if(data.member_tax != 0 )
						{
							$("p.tax").text("Tax: $" + data.member_tax);
						}
						$("p.shipping span").text("$" + data.shipping_price);
						$("p.total span").text("$" + data.purchase_total);
	
		        }, "json");
	});
	
	
	
	
	
	
	
	
	
	

	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
		
});
		
	
	







