// JavaScript Document

/* ***********************************************
ページトップへ戻るJS
************************************************ */
$(function(){
	$("a[href^=#]").click(function(){
		var Hash = $(this.hash);
		var HashOffset = $(Hash).offset().top;
		$("html,body").animate({
		scrollTop: HashOffset
	}, 200);
	return false;
	});
});


/* ***********************************************
マウスオーバー画像切替JS
※オーバー画像（----_ov.---）があれば切り替わる
$(function(){
	$("img").hover(function(){
		$(this).attr("src",$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_ov$2"));
		$("img").error(function(){
			$(this).attr("src",$(this).attr("src").replace(/^(.+)_ov(\.[a-z]+)$/, "$1$2"));
		});
	},function(){
		$(this).attr("src",$(this).attr("src").replace(/^(.+)_ov(\.[a-z]+)$/, "$1$2"));
	});
});
************************************************ */


/* ***********************************************
Selectで言語ページの切り替え
************************************************ */
function selectURL(jpURL,URLtop){
	var topurl = URLtop;
	if(jpURL == 0){
		jp = topurl;
	}
	if(jpURL == 1){
		jp = topurl + "russian/index.php";
	}
	if(jpURL == 2){
		jp = topurl + "chinese/index.php";
	}
	if(jpURL == 3){
		jp = topurl + "japanese/index.php";
	}
	if(jpURL == 4){
		jp = topurl + "arabic/index.php";
	}
	location.href=jp;
}


/* ***********************************************
リスト表示　高さ　揃える
※class名に　columu　を追加する
************************************************ */
$(function(){
	var maxHeight = 0;
	$("div.column").each(function(){
		if(maxHeight < $(this).height()){
			maxHeight = $(this).height();
		}
	}).height(maxHeight);
});


/* ***********************************************
詳細ページ画像切替
************************************************ */
$(function(){
	$('#viewer #view_area #image_main img').each(function(i){
		$(this).attr('id','view' + (i + 1).toString());
		$('#viewer #view_area img:first').css({zIndex:'99'});
	});

	$('#viewer #thumb_area ul li').click(function(){
		var connectCont = $("#viewer #thumb_area ul li").index(this);
		var showCont = connectCont+1;

		$('#viewer #view_area #image_main img#view' + (showCont)).siblings().stop().animate({opacity:'0'},1000);
		$('#viewer #view_area #image_main img#view' + (showCont)).stop().animate({opacity:'1'},1000);

		$(this).addClass('active');
		$(this).siblings().removeClass('active');
	});

	$('#viewer #thumb_area ul li:not(.active)').hover(function(){
		$(this).stop().animate({opacity:'1'},200);
	},function(){
		$(this).stop().animate({opacity:'0.5'},200);
	});

	$('#viewer #thumb_area ul li').css({opacity:'0.5'});
	$('#viewer #thumb_area ul li:first').addClass('active');
});


/* ***********************************************
サイドコンテンツ　サービスエリア表示
************************************************ */
$(function(){
	$("#side_content .section .sec_03 .right_box span").css("display","none");
	$("#side_content .section .sec_03 .right_box .service_area").click(function(){
		if($(this).next("span").css("display") == "none"){
		//alert("test2");
			$(this).next().fadeIn("slow");
		}else{
		//alert("test3");
			$(this).next().fadeOut("slow");
		}
	});
/*
	$("#side_content .section .left_box").hover(function(){
			$("span",this).fadeIn("slow");
			//jQuery("span",this).css("display","block");
			//alert(jQuery("body").width());
		},
		function(){
			$("span",this).fadeOut("slow");
			//jQuery("span",this).css("display","none");
			//alert(jQuery("body").width());
		}
	);
*/
});





