/* カレンダー次月 */
if ($('#calendar-next-month-is').length) {
  $('#calendar-next-month-is').click(function() {
    if ($('#calendar-next-month-is').html() == '次月▼') {
      $('#calendar-next-month').show('slow');
      $('#calendar-next-month-is').html('次月▲');
    }
    else {
      $('#calendar-next-month').hide('slow');
      $('#calendar-next-month-is').html('次月▼');
    }
  });
}

/* 郵便番号検索 */
ShopSearchZip('main-');
ShopSearchZip('side-');
function ShopSearchZip(s) {
  var search = '#' + s + 'search_zip';
  $(search).css('overflow', 'hidden');
  if ($(search).length) {
   $(search).click(function() {
     var keyword = '#' + this.id.split('-')[0] + '-keyword_zip';
     var param = $(keyword).val();
     if (param.length) {
       param = param.replace('-', '');
       if (param.length) {
         if (param.length <= 3) {
           param = (param + '000').slice(0, 3);
         }
         else if (param.length < 7) {
           param = (param + '0000000').slice(0, 7);
         }
       }
     }
     var href = this.href
     + (param.length == 3
       ? '?p3=' + param
       : (param.length == 7
         ? '?p3=' + param.slice(0, 3) + '&p4=' + param.slice(-4)
         : ''
         )
       )
     ;
     location.href = href;
     return false;
   });
 }
}

