//--------------------------------------------------------------------------
//  
//  jquery.effects js
//  
//
//--------------------------------------------------------------------------



//- フェードで画像の透明度を変更
//-------------------------------------------------------------------->
$(function(){
	$("a img.fadeImg").hover(
		function(){$(this).fadeTo(200, 0.5);},
		function(){$(this).fadeTo(200, 1);}
	);
});



//- マウスオーバーで画像を変更
//-------------------------------------------------------------------->
$(function(){
	$('a img.imgover').hover(function(){
        $(this).attr('src', $(this).attr('src').replace('_nm', '_on'));
		}, function(){
        	if (!$(this).hasClass('currentPage')) {
        	$(this).attr('src', $(this).attr('src').replace('_on', '_nm'));
        }
   });
});




//- 外部リンクを別タブで開く
//-------------------------------------------------------------------->
//-$(function(){
//-	$("a[href^='http://']").attr("target","_blank");
//-});



//- ページトップへスクロールする
//-------------------------------------------------------------------->
$(function(){
     $(".goto-pabetop a").click(function(){
     $('html,body').animate({ scrollTop: $($(this).attr("href")).offset().top }, 'slow','swing');
     return false;
     })
});



//- Div全体をクリックできるようにする
//-------------------------------------------------------------------->
$(function(){
	$(".sampleBox").click(function(){
    	window.location=$(this).find("a").attr("href");
    	return false;
    });
});



//- テーブルの偶数・奇数の行の色を変える
//-------------------------------------------------------------------->
$(function(){
	$("tr:odd").addClass("odd");
});



//- listの奇数行（odd）と偶数行（even）をクラスとして追加
//-------------------------------------------------------------------->
$(function(){
	$('ul').each(function(){
		$(this).children('li:odd').addClass('even');
		$(this).children('li:even').addClass('odd');
	});
});



//- :first-child, :last-childをクラスとして追加
//-------------------------------------------------------------------->
$(function(){
	$('ul li:last-child,').addClass('lastChild');
	$('ul li:first-child').addClass('firstChild');
});



//- スライドパネル
//-------------------------------------------------------------------->
$(function(){
	$(".open").click(function(){
      $("#slideBox").slideToggle("slow");
	});
});



//- アコーディオン
//-------------------------------------------------------------------->
$(function() {
   $('#accordion dd').hide();
   $('#accordion dt a').click(function(){
       $('#accordion dd').slideUp();
       $(this).parent().next().slideDown();
       return false;
   });
});



//- ツールチップ
//-------------------------------------------------------------------->
$(function(){
	$(".tooltip a").hover(function() {
	    $(this).next("span").animate({opacity: "show", top: "-75"}, "slow");}, function() {
			$(this).next("span").animate({opacity: "hide", top: "-85"}, "fast");
	});
});



//- プリントダイアログを表示
//-------------------------------------------------------------------->
$(function(){
	$('a.print').click(function(){
		window.print();
		return false;
	});
});







//- リンク切れ画像を差し替える
//-------------------------------------------------------------------->
//- $(function () {
//- 	$('img').error(function(){
//- 		$(this).attr({src:'/common/images/missing.jpg',alt:'画像が見つかりません'});
//- 	});
//- });



//- IE6以下ユーザーにメッセージを表示
//-------------------------------------------------------------------->
//- $(function () {
//- 	if ( $.browser.msie && $.browser.version <= 6 ) {
//- 	        $('body').prepend('<div class="error">あなたは旧式ブラウザをご利用中です。このウェブサイトを快適に閲覧するにはブラウザをアップグレードしてください。</div>');
//- 	}
//- });



//- CSSハックを使わずブラウザーごとにCSSを変更
//-------------------------------------------------------------------->
//- $(function () {
	// IE（IE7以上）
//- 	if ($.browser.msie && $.browser.version > 6 ) $(".browserBox").css("background", "#ff99cc" );	 
	// IE（IE6以下）
//- 	if ($.browser.msie && $.browser.version <= 6 ) $(".browserBox").css("background", "#ffff99" );	 
	// Firefox
//- 	if ($.browser.mozilla ) $(".browserBox").css("background", "#c8ffd0" );
	// Safari
//- 	if( $.browser.webkit ) $(".browserBox").css("background", "#b1e1ff" );
//- });



//- 画像のプリローダー
//-------------------------------------------------------------------->
//- $(function () {
//- 	$('.imgBox img').hide();//ページ上の画像を隠す
//- });
//- 
//- var i = 0;
//- var int=0;
//- $(window).bind("load", function() {//ページコンテンツのロードが完了後、機能させる
//- 	var int = setInterval("doThis(i)",500);//フェードするスピード
//- });
//- 
//- function doThis() {
//- 	var images = $('img').length;//画像の数を数える
//- 	if (i >= images) {// ループ
//- 		clearInterval(int);//最後の画像までいくとループ終了
//-     }
//-     $('img:hidden').eq(0).fadeIn(500);//一つずつ表示する
//-     i++;
//- }



//- Divを消す
//-------------------------------------------------------------------->
//- $(function () {
//- 	$(".deleteBox .delete").click(function(){
//- 	    $(this).parents(".deleteBox").animate({ opacity: "hide" }, "slow"); 
//- 	});
//- });



//- フォーカスしているフォームのラベルにクラスをつける
//-------------------------------------------------------------------->
//- $(function () {
//- 	$("form :input").focus(function() {
//- 		$("label[for='" + this.id + "']").addClass("labelfocus");
//- 	});
//- 	
//- 	$("form :input").blur(function() {
//- 		$("label[for='" + this.id + "']").removeClass("labelfocus");
//- 	});
//- });



//- フォームにテキストを入れておき、フォーカスで消す（文字色も変更）
//-------------------------------------------------------------------->
//- $(function(){
//-      $(".focus").focus(function(){
//-           if(this.value == "キーワードを入力"){
//-                $(this).val("").css("color","#f39");
//-           }
//-      });
//-      $(".focus").blur(function(){
//-           if(this.value == ""){
//-                $(this).val("キーワードを入力").css("color","#969696");
//-           }
//-      });
//- });



//- 入力文字数をカウント
//-------------------------------------------------------------------->
//- $(function () {
//- 	$("textarea").keyup(function(){
//- 		var counter = $(this).val().length;
//-         $("#countUp").text(counter);
//-         if(counter == 0){
//-             $("#countUp").text("0");
//-         } 
//-         if(counter >= 10){
//-             $("#countUp").css("color","red");
//-         } else{$("#countUp").css("color","#666");}
//-     });
//- });



//- ラジオボタンとチェックボックスを装飾する
//-------------------------------------------------------------------->
//- $(function(){
//-     $(".checkbox").change(function(){
//-         if($(this).is(":checked")){
//-             $(this).next("label").addClass("LabelSelected");
//-         }else{
//-             $(this).next("label").removeClass("LabelSelected");
//-         }
//-     });
//-     $(".radio").change(function(){
//-         if($(this).is(":checked")){
//-             $(".RadioSelected:not(:checked)").removeClass("RadioSelected");
//-             $(this).next("label").addClass("RadioSelected");
//-         }
//-     });
//- });









