
//三级地区 MyAddresses.aspx和MyInfo.aspx页面共用
$(document).ready(function(){
	$('#ddlSubAreas option[@value=0]').text(strSelectArea);     //var strSelectArea = '<%=GetResourceString("SelectArea")%>';
    $('#ddlThirdAreas option[@value=0]').text(strSelectArea);
    
	$('#ddlTopAreas').change(function(){
        $('#ddlSubAreas').remove();$('#ddlThirdAreas').remove();
        if($(this).val() == '0'){return false;};
        var areas = '';
        if($('#hideAddressIDs')[0]){
            areas = $('#hideAddressIDs').val().split(',');
        };
        $.ajax({
            url:'ajax.aspx?Nocopyright=1&type=GetSubArea&ParentID=' + $('#ddlTopAreas').val(),
            cache:false,
            success:function(data){
                var objSubArea = $('<select id="ddlSubAreas" name="ddlSubAreas" class="searchvalue"></select>');
                objSubArea.html(data);
                objSubArea.insertAfter($('#ddlTopAreas'));
                if(areas[1]){objSubArea.val(areas[1])};
                objSubArea.change(function(){
                    $('#ddlThirdAreas').remove();
                    if($(this).val() == '0'){return false;};
                    $.ajax({
                        url:'ajax.aspx?Nocopyright=1&type=GetSubArea&ParentID=' + $('#ddlSubAreas').val(),
                        cache:false,
                        success:function(data){
                            var objthirdarea = $('<select id="ddlThirdAreas" name="ddlThirdAreas" class="searchvalue"></select>');
                            objthirdarea.html(data).insertAfter($('#ddlSubAreas'));
                            if(areas[2]){objthirdarea.val(areas[2])};
                        },error:function(){}
                    });
                }).change();
            },error:function(){alert('get address error');}
        });//end ajax
    }).change();//end change
	
	
});