/*------------------------------------------------------------------------------------------------
creation date 2009.9.7
http://www.miturugi.jp
Copyright (C) JIVE Inc. All Rights Reserved.
------------------------------------------------------------------------------------------------*/
$(function()  {  
/*------------------------------
roll over
------------------------------*/
    $.fn.rollover = function(postfix) {
        postfix = postfix || '_on';
        return this.not('[src*="'+ postfix +'."]').each(function() {
            var img = $(this);
            var src = img.attr('src');
            var src_on = [
                src.substr(0, src.lastIndexOf('.')),
                src.substring(src.lastIndexOf('.'))
            ].join(postfix);
            $('<img>').attr('src', src_on);
            img.hover(
                function() {
                    img.attr('src', src_on);
                },
                function() {
                    img.attr('src', src);
                }
            );
        });
    };
	$('a img.on').rollover();
/*------------------------------
addclass forIE6
------------------------------*/
    $('dl:first-child').addClass('firstChild');
		$('#wallpaper .qr li:last-child').addClass('lastChild');
/*------------------------------
scrollto
------------------------------*/
	$('a[href*=#wrapper]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			var target = $(this.hash);
			target = target.length && target;
			if (target.length) {
				var sclpos = 30;
				var scldurat = 1200;
				var targetOffset = target.offset().top - sclpos;
				$('html,body')
					.animate({scrollTop: targetOffset}, {duration: scldurat, easing: "easeOutExpo"});
				return false;
			}
		}
	});
/*------------------------------
fade
------------------------------*/
		$("#container .gNav dd ul li a").css("opacity","0");
		$("#container .gNav dd ul li a").hover( 
			function () {
				$(this).stop().animate({opacity: 1}, 'slow');},
			function () {
				$(this).stop().animate({opacity: 0}, 'slow');}
		);
});
/*------------------------------
inline bg for IE
------------------------------*/
$.fn.extend({
  inlineBgFix: function() {
    if ($.browser.msie && $.browser.version < 8.0) {
      $(this)
	  	.addClass("none")
        .append('<span>&nbsp;</span>');
   	}
  }
});
$(function() {
  $('body#top #container a[href^="http"] ').inlineBgFix();
});