//ChuJia.aspx和TGShow.aspx共用此文件
$(document).ready(function() {
	$('#ShowAddress').click(function(){
	    $.ajax({
	        url:shopFolder + 'ajax.aspx?NoCopyRight=1&type=GetReceiveAddress',
	        dataType:'json',
	        cache:false,
	        success:function(msg){
	            if(msg.NoLogin){
	                if(confirm('您还未登录,是否现在登录?')){
	                    window.location.href = shopFolder + 'Login.aspx?ReturnUrl=' + window.location.href;
	                };
	            }else{
	                $('#al_template').nextAll().remove();
	                $.each(msg.Address,function(i,n){
	                    var temp = $('#al_template').clone().show();
	                    temp.find('.al_addr').text(n.ReceiverAddress);
	                    temp.find('.al_receiver').text(n.ReceiverName);
	                    temp.find('.al_phone').text(n.ReceiverPhone);
	                    temp.find('.al_zip').text(n.ReceiverZip);
	                    temp.find('.al_select').find('a').click(function(){
	                        $('#txtRAddress').val(n.ReceiverAddress);
	                        $('#txtRName').val(n.ReceiverName);
	                        $('#txtRPostalcode').val(n.ReceiverZip);
	                        $('#txtRTelephone').val(n.ReceiverPhone);
	                        $('#closepop').click();
	                        return false;
	                    });
	                    $('#AddressList').append(temp);
	                });
	                $('#PopAddress').popup({
	                    width:500,
	                    height:200,
	                    isFixed:true,
	                    btnClose:'closepop'
	                });
	            };//end else
	        },
	        error:function(){alert('error');}
	    });
	});

});
