// JavaScript Document

/* ----------------------------------------
	top menu
---------------------------------------- */
$(function(){	
	$("#upmenu li").hover(
		function(){


			var upid = this.id;
			var num = upid.charAt(4)
//			$("#img" + num).css("margin-top", "-7px");
			$(this).css("cursor", "pointer");
			$("#img" + num).animate({ opacity: 0.8, marginTop: "-7px" },400 );
		},
		function(){
			var upid = this.id;
			var num = upid.charAt(4)
//			$("#img" + num).css("margin-top", "0px");
			$(this).css("cursor", "default");
			$("#img" + num).animate({ opacity: 1.0, marginTop: "0px" }, 300 );
		}
	);
	$("#upmenu li").click(
		function(){
			location.href = $(this).attr("rel");
		}
	);
});

/* ----------------------------------------
	header menu
---------------------------------------- */
$(function(){
	$("#left li").hover(
		function(){
			$(this).css("cursor", "pointer");
		},
		function(){
			$(this).css("cursor", "default");
		}
	);
	
	$("#left li").click(
		function(){
			location.href = $(this).attr("rel");
		}
	);
});

/* ----------------------------------------
	slide show
---------------------------------------- */
var time = 4000;
var num = 0;

$(document).ready(function() {
	slideshow();

	$(function(){
		$("#gallery_show").hover(
			function(){
				clearInterval(timerID);
				$("#gallery_show").css("cursor", "crosshair");
				$("#gallery_show").fadeTo("normal", "0.8");
			},
			function(){
				timerID = setInterval('htmlview()',time);
				$("#gallery_show").css("cursor", "default");
				$("#gallery_show").fadeTo("normal", "1.0");
			}
		);
	});
});

function slideshow(){
	//最初にページ開いたとき用
	if(num == 0){
		num++;
		$("#gallery_show").append($("#gallery_img" + num).html());
		$("#gallery_show").fadeTo("fast", "1.0");
		$("#gallery_show").fadeIn("slow");
	}

	//タイマー処理開始
	timerID = setInterval('htmlview()',time);
}

function htmlview(){
	$("#gallery_show").css("display", "none");
	$("#gallery_show").text('');

	num++;

	if($("#gallery_img" + num).html() == undefined){
		num = 1;
	}

	$("#gallery_show").append($("#gallery_img" + num).html());
	$("#gallery_show").fadeTo("fast", "1.0")
	$("#gallery_show").fadeIn("slow");
}

/* ----------------------------------------
	mail form
---------------------------------------- */
function mailsend(){
	if(confirm('入力した内容を送信します。\nよろしいですか？')){
		$("#sendflg2").val("1");
		document.mailform.submit();
	}else{
		return false;
	}
}

