// JavaScript Document

if(!/MSIE.+Mac/.test(navigator.userAgent)){(function(){

	/* get root directory */
	
	function getRootDir() {
		var s = document.getElementsByTagName("script")[0].src;
		var n = s.indexOf("js");
		s = s.substr(0,n) + "js/";
		return s;
	}
	var root = getRootDir();
	var imports = function(){
		for(var i=0,l=arguments.length;i<l;i++){
			document.write('<script type="text/javascript" src="' + root + arguments[i] + '"><\/script>');
		}
	}
	
	/* import js files */
	imports('scrolling.js');
	imports('jquery.flatheights.js');
})();}
	
	
jQuery.noConflict();
jQuery(document).ready(function(){
});


/*ロールオーバーゆっくり*/
jQuery(document).ready(function(){  
   jQuery('.btn a').hover(function(){  
   jQuery(this).stop().animate({'opacity' : '0'}, 400);  
   }, function(){jQuery(this).stop().animate({'opacity' : '1'}, 600);});  
});

/*img画像ロールオーバーゆっくり*/
jQuery(document).ready(function(){  
   jQuery('a img').hover(function(){  
   jQuery(this).stop().animate({'opacity' : '0.5'}, 400);  
   }, function(){jQuery(this).stop().animate({'opacity' : '1'}, 600);});  
});

/*3番目だけパディングなし*/
  jQuery(document).ready(function(){
    jQuery(".contents .box ul.cont li:nth-child(3n)").css("margin-right", "0");
  });
/*3番目だけパディングなし*/
  jQuery(document).ready(function(){
    jQuery("ul.team li:nth-child(3n)").css("margin-right", "0");
  });
/*2番目だけパディングなし*/
  jQuery(document).ready(function(){
    jQuery(".contents .box dl.li dd ul li:nth-child(2n)").css("margin-right", "0");
  });
  
/*4番目だけパディングなし*/
  jQuery(document).ready(function(){
    jQuery("dl.listbox dd ul:nth-child(4n)").css("width", "150");
  });
  
/*ニュースリリース*/
  jQuery(document).ready(function(){
    jQuery(".news dl:nth-child(2n)").addClass("yellow");
  });
  
  
/*リストの高さを揃える*/ 
jQuery(function(){
    var sets = [], temp = [];
    jQuery('.contents .box ul.cont li').each(function(i){
        temp.push(this);
        if (i % 3 == 2){ // 1行の数を指定し、1を引いた数を右に指定
            sets.push(temp);
            temp = [];
        }
    });
    if (temp.length) sets.push(temp);
 
    jQuery.each(sets, function(){
        jQuery(this).flatHeights();
    });
});


/*ロールオーバー*/
jQuery(document).ready(function(jQuery) {
	var postfix = '_o';
	jQuery(' a img.over').not('[src*="'+ postfix +'."]').each(function() {
		var img = jQuery(this);
		var src = img.attr('src');
		var src_o = src.substr(0, src.lastIndexOf('.'))
		           + postfix
		           + src.substring(src.lastIndexOf('.'));
		jQuery('<img>').attr('src', src_o);
		img.hover(
			function() {
				img.attr('src', src_o);
			},
			function() {
				img.attr('src', src);
			}
		);
	});
});

