1 // Place your application-specific JavaScript functions and classes here
2 // This file is automatically included by javascript_include_tag :defaults
4 function fnSubWindow(URL,Winname,Wwidth,Wheight){
7 WIN = window.open(URL,Winname,"width="+Wwidth+",height="+Wheight+",scrollbars=yes,resizable=yes,toolbar=no,location=no,directories=no,status=no");
11 function address_by_zip(zipcode_first, zipcode_second, prefecture_name, city_name, town_name, prefecture_id, controller){
13 var first = $F(zipcode_first);
14 var second = $F(zipcode_second);
15 if (first.length != 3 || second.length != 4) {
16 alert("郵便番号を入力してください。");
19 var params = $H({first: first, second: second});
20 new Ajax.Request('/'+controller+'/get_address?' + params.toQueryString(), {
22 onSuccess: function(request) {
23 var data = request.responseText.split("/");
24 if($(prefecture_name) != null){
25 $(prefecture_name).value = data[0];
27 $(city_name).value = data[1] + data[2];
28 if($(prefecture_id) != null){
29 $(prefecture_id).value = data[3];
32 onFailure: function(request) { alert("該当する郵便番号がありません")
38 Event.observe(window, 'load', function() {
39 var img = document.createElement('img');
40 document.body.appendChild(img);
41 img.id = 'loading-image';
42 img.alt = 'loading...';
49 img.src = '/images/indicator.gif';
51 img.style.marginLeft = String(-(img.width / 2)) + 'px';
52 img.style.marginTop = String(-(img.height / 2)) + 'px';
56 Ajax.Responders.register({
57 onCreate: function() {
58 Element.show('loading-image');
59 //document.body.style.cursor = 'wait';
61 onComplete: function() {
62 if(Ajax.activeRequestCount == 0){
63 Element.hide('loading-image');
64 //document.body.style.cursor = 'auto';