
// mouseover script
// @param なし
// @return なし
$(function imgOver() {
    $('img, input:image').each(function() {
        var node = this;
        if(node.src.match("_off.")) {
            node.originalSrc = node.src;
            node.temporarySrc = node.originalSrc.replace(/_off/,'');
            node.rolloverSrc = node.temporarySrc.replace(/(\.gif|\.jpg|\.png)/,'_on'+"$1");
            node.activeSrc = node.temporarySrc.replace(/(\.gif|\.jpg|\.png)/,'_active'+"$1");
            //画像のプリロード処理開始
            preloadImage(node.rolloverSrc);
            //Mouseover
            node.onmouseover = function() {
                if(this.className!='active') {
                    this.src = this.rolloverSrc;
                }
            }
            //Mouseout
            node.onmouseout = function() {
                if(this.className!='active') {
                    this.src = this.originalSrc;
                }
            }
        }
    });
});


// 画像のプリロードを行う関数
// @param string 画像のパス
// @return なし
preloadImages = [];
preloadImage = function(path) {
    var pre = preloadImages;
    var len = pre.length;
    pre[len] = new Image();
    pre[len].src = path;
}

// CSS調整
$(function addTrClass() {
	$("#TPBOX .newsbox .newsin dl:first").addClass("top");
	$("#Contents .com_tbbox02 table tr:last th").addClass("bot");
	$("#Contents .com_tbbox02 table tr:last td").addClass("bot");
	$("#Contents .com_tbbox").each(function() {
		$(this).find("tr:last").children("th").addClass("bot");
		$(this).find("tr:last").children("td").addClass("bot");		
	});		
	$("#Contents .com_tbbox table td ul.cheack-ul").each(function() {
		$(this).children("li:last").addClass("bot");
		$(this).children("li:even").addClass("even");
	});	
	$("#Contents .com_tbbox table td ul.cheack-lr li").each(function() {
		$(this).children("select:first").addClass("top");
	});		
	$("#Sidebox .menubox ul li ul").each(function() {
		$(this).children("li:last").addClass("bot");
	});
});

// ROBGNON
$(function bgnonRO() {
    $('img').each(function() {
		$(this).parents("a").css("background","none");
    });
});


// サイドスライドエリアメニュー
$(function SideSlidAarea() {
    $('#Sidebox .menubox ul li.open ul').show();
	$('#Sidebox .menubox ul li.open').addClass("over");
	

	$('#Sidebox .menubox ul.ver02 li a.Larea').click(function () {
			
		var thisli =$(this).parents("li");
		if(thisli.is(".over")){
			thisli.removeClass("over");
		} else {
		    thisli.addClass("over");		
		}
	
		$(this).siblings("ul").slideToggle("fast");
        return false;
	});


	$('#Sidebox .menubox ul.ver01 li').hover(function () {
			
		var thisli =$(this);
		if(thisli.is(".over")){
			thisli.removeClass("over");
		} else {
		    thisli.addClass("over");		
		}	
		$(this).children("ul").fadeIn("slow");
		
	},function () {

		var thisli =$(this);
		if(thisli.is(".over")){
			thisli.removeClass("over");
		} else {
		    thisli.addClass("over");		
		}	
		$(this).children("ul").hide();
		
	});
	

});



//外部リンクにクラス名「external」、target="_blank"を追加
$(function addBlankExtLink() {
    var selfDomain = document.domain;
    $('a').each(function() {
        if((this.href.indexOf(selfDomain)==-1) && (this.href.indexOf('mailto')==-1) && (this.href.indexOf('http://www.adobe.com/')==-1)) {
            $(this).addClass('external');
            $(this).attr('target','_blank');
        }
    });
});

//ベリサイン
$(function VeriSign() {
    $("a.external").attr("target","_blank");
});

//ページスクロール
$(function pagetop() {
        $('.com_pagetop a').click(function () {
            $(this).blur();

			if (window.opera)
			{
				$('html').animate({ scrollTop: 0 }, 'fast');
			}else{
				$('html,body').animate({ scrollTop: 0 }, 'fast');
			}
            return false;
        });
});
