/**
 * @name main.js
 * @fileOverview
 * @version 1.1
 * @description
 * <p>(c) FOURDIGIT Inc. Licensed <a href="http://ja.wikipedia.org/wiki/GNU_General_Public_License">GNU General Public License</a>.</p>
 */

//他ライブラリと共存する場合、下の一行コメントアウト解除($無効化)
//jQuery.noConflict();

/**
 * config
 */
(function($){
	$(function() {
	//bodyのクラスにブラウザ情報を追加
		$.addClassUA();
	//easyOverのターゲット設定
		$("img.ahover, .ahoverArea img").easyOver();
	//IE5,6にてPNG有効化
		//$.autoEnablePNG();
	//Flash
		//$("object, embed").enableFlash();
  //HTML5タグ有効化
  	//$.enableHTML5();
	//ポップアップリンクに置換
		$(".commonPop").easyPop();
	//他ドメインリンク時にpageTracker有効化
		//$("a,area").blankLogToGoogle();
	//アンカーリンクをスムージング
		$("a[href^=#]:not(.notSmooth a)").smoothScroll();
	//対象の要素をスクロールに追従するようにする
		//$("#fixBox").fixPosition("stopperID","normal");
	//対象の要素がopenerを判別して挙動を変える
		//$("a.moveOpener, area.moveOpener").moveOpener();
	//heightline
	  $(".separator").each(function(){
	    $(this).heightline(".box");
	  });
	});

	//タブ
	$(function(){
		$(".tabsBody:not("+$(".tabs li a.selected").attr("href")+")").hide();
		$(".tabs li a").click(function(){

			$(".tabs li a img").removeClass("selected");
			$("img", this).addClass("selected");

			//サムネイルをoff
			$(".tabs li a img").each(function(){
				if($(this).not(".selected").length){
					$(this).attr("src", $(this).attr("src").replace("_ov.", "."));
				}
			});

			$(".tabs li a").removeClass("selected");
			$(this).addClass("selected");
			$(".tabsBody").hide();
			$($(this).attr("href")).show();
			return false;

		});

		$(".tabs li a img").mouseover(function(){
			//off画像
			var offimgSrc = $(this).attr("src").replace("_ov.", ".");
			//over画像
			var overimgSrc = offimgSrc.replace(".", "_ov.");
			//親のaタグ
			var MyArea = $(this).parents("a");
			//over画像に入れ替え
			$(this).attr("src", overimgSrc);
			//マウスが外れたら…
			$(this).mouseout(function(){
				if($(MyArea).not(".selected").length){
					$(this).attr("src", offimgSrc);
				}
			});
		});
	});

	//FAQ
	$(function(){
		$("#shared3g .questionBlock li:nth-child(even)").css("background-color", "#fafbf8");
		$("#dedicated .questionBlock li:nth-child(even)").css("background-color", "#f4f6ff");
		$("#dc-plus .questionBlock li:nth-child(even)").css("background-color", "#f2f7fb");
		$("#partner .questionBlock li:nth-child(even)").css("background-color", "#f4f6ff");
	});

	//Accordion
	$(function(){
		var allView = $(".btnView li");
		//親のUL
		var MyUl = $(allView).parents("ul");

		$(".more, .btnView li:not(.selected)").hide();
		$(allView).click(function(){
			$(".more").slideToggle(6000);
			$(".selected").hide();
			$("li", MyUl).toggleClass("selected");
			$(".selected").show();
		});
	});

	//tooltip
	$(function(){
		$(".tooltip").parent().hover(function() {
			$(".tooltipCts",this).animate({opacity: "show", bottom: "21"}, "fast");}, function() {
			$(".tooltipCts",this).animate({opacity: "hide", bottom: "31"}, "fast");
		});
	});

/*
	// フォーカスで消える文字
	$(function(){
		$("input[type='text']").focus(function() {
			if($(this).val() == $(this).attr('defaultValue')) {
				$(this).css('color', '#333').val('');
			}
		}).blur(function() {
			if(jQuery.trim($(this).val()) == "") {
				$(this).css('color', '#ccc').val($(this).attr('defaultValue'));
			}
		});
	});
*/



})(jQuery);
