
$(function(){
  // GClientGeocoderオブジェクトの生成
  var geocoder = new GClientGeocoder();

  // 逆ジオコーディングの実行
  //$(".baseinfo, .loginfo").each(function(){
  // use array because each-itaration use same namespace.
  //$(this).find('.geo_point').each(
  $('.geo_point').each(
    function(){
      var t = $(this);
      if (t.html().length > 3 ){
	var point = new GLatLng(t.html().split(',')[0] * 1,t.html().split(',')[1] * 1);
	geocoder.getLocations(point, function(response){
	  if(response.Status.code == 200){
	      t.html(response.Placemark[0].address);
	    }else{
	      t.html('----');
	    }
	});
      }
    });
  //});
  
  function i18n_convert_date(str){
    d = str.split(' ');
    day = d[0];
    month = d[1];
    year = d[2];
    if ($.cookie('lang') == 'ja'){
      day += '日';
      month += '月';
      year += '年';
      return year + ' ' + month + ' ' + day;
    }else{
      return str;
    }
  };
  
  $('.date span').each(function(){
    $(this).text(i18n_convert_date($(this).text()));
  });
  
});
