jQuery(function($) {
  // Open new window
  $('a[href^="http://"]').click(function() {
    window.open(this.href, null);
    return false;
  });

  // Rollover
  $('img[src*="btn"], input:image').rollover('_o', '_d');

  // Placeholder
  $('text[placeholder], textarea[placeholder]').placeholder();

  // Pref and Area
  $('select.prefSelect').relatedSelect('select.areaSelect');

  // Coupon link
  $('#mainArea').delegate('a.couponLink', 'click', function() {
    if (!yunavi.isLogin) {
      return true;
    }
    window.open(this.href, 'couponWindow', 'width=640,height=480,scrollbars=1');
    return false;
  });

  // AutoHeight
  $('#sentoReportBath .sentoReportGallery li').autoHeight({column:5,clear:1});
  $('#sentoReportRest .sentoReportGallery li').autoHeight({column:5,clear:1});
  $('#sentoReportFood .sentoReportGallery li').autoHeight({column:5,clear:1});
  $('#sentoReportFacilities .sentoReportGallery li').autoHeight({column:5,clear:1});
  $('.modSubBlockHalfInner').autoHeight({column:2,clear:1});

  // thickbox
  var imgLoader = new Image();
  imgLoader.src = '/img/loadingAnimation.gif';
  tb_init('.thickbox', imgLoader);

  // Notification
  $('.message')
    .hide()
    .css({position: 'fixed'})
    .slideDown(2000)
    .delay(5000)
    .slideUp(500)
    .click(function() { $(this).dequeue(); });

  // FindSelect
  $('select.findSelect').show().change(function() {
    var url = $(':selected', this).val();
    if (url != null) {
      location.href = url;
    }
  });
});
