function imgRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");

		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match("__roll."))
			{
				images[i].onmouseover = function() {
					this.setAttribute("src", this.getAttribute("src").replace("__roll.", "__rollon."));
				}
				images[i].onmouseout = function() {
					this.setAttribute("src", this.getAttribute("src").replace("__rollon.", "__roll."));
				}
			}
		}
	}
}

if(window.addEventListener) {
	window.addEventListener("load", imgRollover, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", imgRollover);
}

//-----------------------------------------------------------------------
//	ロールオーバーで画像を変更
//-----------------------------------------------------------------------
	
function initRollOverImages() {
	//プリロード用オブジェクトを定義
	var image_cache = new Object();
 	$("div.subColumn > div.mainNavi > dl > dt img").each(function(i) {
		//src属性を取得
		var imgsrc = this.src;
		
		//拡張子前の「.」間での文字数を取得
		var dot = this.src.lastIndexOf('.');
		
		//「.」前までの文字列に「_ov」を付加して、最後に拡張子を足して変数に格納
		//(ロールオーバー後の画像のsrc属性を生成)
		var imgsrc_on = this.src.substr(0, dot) + '_ov' + 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);

$(document).ready(function(){

	//-----------------------------------------------------------------------
	// サブメニューの折りたたみ
	//-----------------------------------------------------------------------

	//dd要素はロード時に隠す
	$("div.mainNavi dl dd").hide();
	
	$uri = location.href;
	
	if($uri.match("\/antenna\/")!=null){
		$("dt#menu01+dd:hidden").show();
	}else if($uri.match("\/chiba\/")!=null){
		$("dt#menu02+dd:hidden").show();
	}else if($uri.match("\/trouble\/")!=null){
		$("dt#menu03+dd:hidden").show();
	}else if($uri.match("\/how\/")!=null){
		$("dt#menu04+dd:hidden").show();
	}else if($uri.match("\/service\/")!=null){
		$("dt#menu05+dd:hidden").show();
	}else if($uri.match("\/now\/")!=null){
		$("dt#menu06+dd:hidden").show();
	}else if($uri.match("\/digital\/")!=null){
		$("dt#menu07+dd:hidden").show();
	}
	
		
	$("dt#menu01").click(function(){
		$("dt#menu01+dd").slideToggle(30);
	});
	$("dt#menu02").click(function(){
		$("dt#menu02+dd").slideToggle(30);
	});
	$("dt#menu03").click(function(){
		$("dt#menu03+dd").slideToggle(30);
	});
	$("dt#menu04").click(function(){
		$("dt#menu04+dd").slideToggle(30);
	});
	$("dt#menu05").click(function(){
		$("dt#menu05+dd").slideToggle(30);
	});
	$("dt#menu06").click(function(){
		$("dt#menu06+dd").slideToggle(30);
	});
	$("dt#menu07").click(function(){
		$("dt#menu07+dd").slideToggle(30);
	});
});


$(document).ready(function(){
	$("a img").hover(function(){
		if(!$(this).attr("class").match("nohover")){
			$(this).parent().addClass('imgHover');
			$(this).animate({opacity:0.6},100);
		}
	},
	function(){
		$(this).animate({opacity:1.0},100,function(){$(this).parent().removeClass('imgHover');});
	}
	);
});