/*-------------------------
filename:funciton.js
author:makoto kimura

update:20110417

-------------------------*/

jQuery(function ($) {

/* -------------------------
スムーススクロール
------------------------- */

  $('a[href*=#]').click(function () {
    var $target = $(this.hash);
    var targetY = $target.offset().top;
    $($.browser.opera ? document.compatMode == 'BackCompat' ? 'body' : 'html' : 'html,body').animate({
      scrollTop: targetY
    }, 500);
    return false;
  });

/* -------------------------
クラス
------------------------- */
$('.after #nav_contents li:last').css('margin','0');
$('#primary .choice li:last').addClass('last');


/* -------------------------
ロールオーバー
------------------------- */

  $('.images a img').hover(function () {
    $(this).fadeTo('normal', 0.70);
  }, function () {
    $(this).fadeTo('normal', 1.0);
  });

/* -------------------------
tableセルの色分け
------------------------- */

  $("table.topicsAll tr:nth-child(odd)").addClass("odd");
  $('.gn_head').hover(function () {
    $('.gn_body', this).stop(true, true).slideToggle('fast');
  });
		
		
/* -------------------------
target指定
------------------------- */
try {
  (function () {
    $(document).ready(function () {
      var hostnamePattern = new RegExp("^https?://" + "(?:[^/]+\\.)?" + location.hostname.replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]", "g"), "\\$&") + "/"),
        protocolPattern = new RegExp("^[A-Za-z]+://");
      $("a").each(function (i) {
        if (typeof ($(this).attr("href")) == "string" && typeof ($(this).attr("target")) != "string") {
          if (!$(this).attr("href").match(protocolPattern) || $(this).attr("href").match(hostnamePattern)) {
            $(this).attr("target", "new");
          } else {
            $(this).attr("target", "_blank");
          }
        }
      });
    });
  })();
} catch (e) {}
		
		
		
		
});




