//----------------------------------------------------
// Name: jquery_setting.js
// Date Created:2009/02/15 [t.sato]
// Last Updated:2009/03/16 [t.sato]
// Copyright:Prudence.inc
//----------------------------------------------------


/*　まとめてCSS設定
======================================================================
 var CSSname = '.class,#ID';　// ''内にクラス名、ID名を設定。カンマ区切り
 
【CSSclearfix】	clearfix(jquery_setting.css)を指定
【CSSsideways】 横並びDT/DD。sideways(jquery_setting.css)を指定

======================================================================
*/

$(function() {
	var CSSclearfix = '#contents,#mainColumn, .course_list_bottom, .banner_area, #job #leftColumn';
	var CSSsideways = 'dl.news';

$(CSSclearfix).addClass('clearfix');
$(CSSsideways).addClass('sideways');
});


/*　角丸
======================================================================
	$('.class').corners();
　$(.class)で指定したブロックを角丸にする。
	http://www.atblabs.com/jquery.corners.html

　角の丸さの指定方法
	$('.rounded').corners("7px");
	class="corners {10px}"
	//15px top：上の角のみ丸める。top right bottom left top-left top-right bottom-left bottom-right
	//anti-alias：アンチエイリアス
	
	!!!!!!!■■ 使わない場合は設定を削除すること■■!!!!!!
	
$(document).ready(function(){
	$('.rounded').corners("10px top");
	$('.lineRounded').corners();
});

======================================================================
*/



/*　nの倍数だけCSS処理を変える
======================================================================
	$("#floatList li:nth-child(5n)").addClass('liRight'); 
	#floatList liの5個毎に.liRightを付ける。
	nがなければ、1回目のみ。最初の5つすべてに対する場合は『:lt(3)』
======================================================================
*/

$(document).ready(function() {
// support/index.html
	$(".support_bot li:nth-child(2n)").addClass('picRight'); 

// about/xxxxx.html #tab_select_about li,
	$("#tab_select_about li:nth-child(5n)").addClass('tabRight'); 
	$("#tab_select_about_bottom li:nth-child(5n)").addClass('tabRight'); 
});


/*　画像ロールオーバー
======================================================================
	initRollOverImages
	マウスオン画像はマウスオフ画像に "_on" をつけたものにすると、
	適用したスタイルの画像がロールオーバーになる。
======================================================================
*/

function initRollOverImages() {   
    var image_cache = new Object();   
    $(".swap a img").not("[src*='_on.']").each(function(i) {   
        var imgsrc = this.src;   
        var dot = this.src.lastIndexOf('.');   
        var imgsrc_on = this.src.substr(0, dot) + '_on' + this.src.substr(dot, 4);   
        image_cache[this.src] = new Image();   
        image_cache[this.src].src = imgsrc_on;   
        $(this).hover(   
            function() { this.src = imgsrc_on; },   
            function() { this.src = imgsrc; }   
        );   
    });   
}   
$(document).ready(initRollOverImages);

/*
======================================================================
	$(expr).flatHeights()
	$(expr)で選択した複数の要素について、それぞれ高さを
	一番高いものに揃える

<HTML>内に記述
	$(function() {
		$('#store_list > div').flatHeights();
		$('#ad, #main, #nav').flatHeights();
		$('.box1').flatHeights();
	})
======================================================================
*/

(function($) {

	/* 対象となる要素群の集合 */
	var sets = [];

	/* 高さ揃えの処理本体 */
	var flatHeights = function(set) {
		var maxHeight = 0;
		set.each(function(){
			var height = this.offsetHeight;
			if (height > maxHeight) maxHeight = height;
		});
		set.css('height', maxHeight + 'px');
	};

	/* 要素群の高さを揃え、setsに追加 */
	jQuery.fn.flatHeights = function() {
		if (this.length > 1) {
			flatHeights(this);
			sets.push(this);
		}
		return this;
	};

})(jQuery);





