<!--

    //郵便番号取得
    function getAddress(){
        var zip1 =document.getElementById('zip1').value;
        var zip2 =document.getElementById('zip2').value;
        var str = zip1 + zip2;
        var han = "0123456789";
        var zen = "０１２３４５６７８９";
        var zip="";

        //半角に置換
        for (i=0; i<str.length; i++){
            c = str.charAt(i);
            n = zen.indexOf(c,0);
            if (n >= 0) { c = han.charAt(n); }
            if(!c.match(/[^0-9]+/)){ zip += c; }
        }

        if( zip1.length == 3 && zip2.length == 4 ){
            GetAddress(zip);
        }
    }

    //住所の取得
    function GetAddress(zip) {
        var url = '/zip/';
        var pars = 'zip=' +  zip;
        var myAjax = new Ajax.Request(url, { method: 'get', parameters: pars, onComplete: AddressResponse });
    }

    //住所の出力
    function AddressResponse(req) {
        var data =eval(decodeURIComponent(req.responseText));

        if (data[0].pref) {

            document.getElementById('pref_id').value = data[0].pref;
            document.getElementById('address1').value = data[0].city;
            document.getElementById('address2').value = data[0].town;
        }
    }

    //郵便番号取得
    function getAddress2(){
        var zip1 =document.getElementById('zip1').value;
        var zip2 =document.getElementById('zip2').value;
        var str = zip1 + zip2;
        var han = "0123456789";
        var zen = "０１２３４５６７８９";
        var zip="";

        //半角に置換
        for (i=0; i<str.length; i++){
            c = str.charAt(i);
            n = zen.indexOf(c,0);
            if (n >= 0) { c = han.charAt(n); }
            if(!c.match(/[^0-9]+/)){ zip += c; }
        }

        if( zip1.length == 3 && zip2.length == 4 ){
            GetAddress2(zip);
        }
    }

    //住所の取得
    function GetAddress2(zip) {
        var url = '/zip/';
        var pars = 'zip=' +  zip;
        var myAjax = new Ajax.Request(url, { method: 'get', parameters: pars, onComplete: AddressResponse2 });
    }

    //住所の出力
    function AddressResponse2(req) {
        var data =eval(decodeURIComponent(req.responseText));

        if (data[0].pref) {

            document.getElementById('pref_id').value = data[0].pref;
            document.getElementById('address1').value = data[0].city + data[0].town;
        }
    }

    //郵便番号取得
    function getAddress3(){
        var zip1 =document.getElementById('zip21').value;
        var zip2 =document.getElementById('zip22').value;
        var str = zip1 + zip2;
        var han = "0123456789";
        var zen = "０１２３４５６７８９";
        var zip="";

        //半角に置換
        for (i=0; i<str.length; i++){
            c = str.charAt(i);
            n = zen.indexOf(c,0);
            if (n >= 0) { c = han.charAt(n); }
            if(!c.match(/[^0-9]+/)){ zip += c; }
        }

        if( zip1.length == 3 && zip2.length == 4 ){
            GetAddress22(zip);
        }
    }

    //住所の取得
    function GetAddress22(zip) {
        var url = '/zip/';
        var pars = 'zip=' +  zip;
        var myAjax = new Ajax.Request(url, { method: 'get', parameters: pars, onComplete: AddressResponse22 });
    }

    //住所の出力
    function AddressResponse22(req) {
        var data =eval(decodeURIComponent(req.responseText));

        if (data[0].pref) {

            document.getElementById('pref_id2').value = data[0].pref;
            document.getElementById('address21').value = data[0].city + data[0].town;
        }
    }

//-->
