function setting(){
	//クラスを付加
	jQuery('ul, ol, dl, table, tbody').each(function(){
		//jQueryは0から数えるのでevenとaddを逆に指定
		jQuery(this).children('li:odd').addClass('even');
		jQuery(this).children('li:even').addClass('odd');
		
		jQuery(this).children('dt:odd').addClass('even');
		jQuery(this).children('dt:even').addClass('odd');
		jQuery(this).children('dd:odd').addClass('even');
		jQuery(this).children('dd:even').addClass('odd');
		
		jQuery(this).children('tr:odd').addClass('even');
		jQuery(this).children('tr:even').addClass('odd');
	});
	
	jQuery('table tr').each(function(){
		jQuery(this).children('th:odd').addClass('roweven');
		jQuery(this).children('th:even').addClass('rowodd');
		jQuery(this).children('td:odd').addClass('roweven');
		jQuery(this).children('td:even').addClass('rowodd');
	});

	//:first-child, :last-childをクラスとして追加
	//全タグだと邪魔なので、first、lastを使いそうな特定のタグだけに限定。
	jQuery('body li:first-child,body tr:first-child,body th:first-child,body td:first-child').addClass('first');
	jQuery('body li:last-child,body tr:last-child,body th:last-child,body td:last-child').addClass('last');
	//個人的に使う可能性があるものなので、あえて別記述とした。
	jQuery('body dt:first-child,body blockquote p:first-child').addClass('first');
	jQuery('body dd:last-child,body blockquote p:last-child').addClass('last');
}



function scroller(){
   // #で始まるアンカーをクリックした場合に処理
   jQuery('a[href^=#]').click(function() {
      // スクロールの速度
      var speed = 600;// ミリ秒
      // アンカーの値取得
      var href= jQuery(this).attr("href");
      // 移動先を取得
      var target = jQuery(href == "#" || href == "" ? 'html' : href);
      // 移動先を数値で取得
      var position = target.offset().top;
      // スムーススクロール
      jQuery(jQuery.browser.safari ? 'body' : 'html').animate({scrollTop:position}, speed, 'swing');
      return false;
   });

}

/**
 * 指定した要素の天地をそろえる
 * Flatten height same as the highest element for each row.
 * Copyright (c) 2011 Hayato Takenaka
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * @author: Hayato Takenaka (http://urin.take-uma.net)
 * @version: 0.0.2
**/
;(function($) {
	$.fn.tile = function(columns) {
		var tiles, max, c, h, last = this.length - 1, s;
		if(!columns) columns = this.length;
		this.each(function() {
			s = this.style;
			if(s.removeProperty) s.removeProperty("height");
			if(s.removeAttribute) s.removeAttribute("height");
		});
		return this.each(function(i) {
			c = i % columns;
			if(c == 0) tiles = [];
			tiles[c] = $(this);
			h = tiles[c].height();
			if(c == 0 || h > max) max = h;
			if(i == last || c == columns - 1)
				$.each(tiles, function() { this.height(max); });
		});
	};
})(jQuery);
jQuery(document).ready(setting);
jQuery(document).ready(scroller);



//必要箇所のボックスの天地をそろえる
jQuery(function(){
	jQuery(".top_ranking .itemname").tile();	//トップランキングの商品名の高さ
	jQuery(".top_jyoyu .name").tile();	//トップ女優6人名前の高さ
	jQuery(".j_box dd").tile();	//女優リストの名前の高さ（全体でそろえています）
	//以下のように4と書くと、4つ単位で高さをそろえます、というサンプル
	//$(".item_name").tile(4);
});
