/* ==============================
     初期処理
================================= */
function init() {
	/* 表示・非表示処理 */
	obj = document.getElementsByName("typ");
	typ = "";
	for (i=0; i<obj.length; i++) {
		if (obj[i].checked) {
			typ = obj[i].value;
			break;
		}
	}
	click_typ(typ);
	
	/* 画像処理 */
	MM_preloadImages('/gif/btn_shop2.gif','/gif/btn_rental2.gif','/gif/btn_gallery2.gif','/gif/btn_course2.gif','/gif/btn_blog2.gif','/gif/btn_form2.gif');
}

/* ==============================
     画像処理
================================= */
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/* ==============================
     メールアドレス表示
================================= */
function editmail() {
	var ad = converter(String.fromCharCode(104,109,101,110,63,111,96,114,114,104)+String.fromCharCode(110,109,100,44,106,120,110,115,110,45,105,111));
	document.write("<a href='mai"+"lto:"+ad+"'><img src='/gif/info.gif' class='mailimg'></a>");
}

function converter(M){
	var str="", str_as="";
	for(var i=0;i<M.length;i++){
		str_as = M.charCodeAt(i);
		str += String.fromCharCode(str_as + 1);
	}
	return str;
}

/* ==============================
     内容変更処理
================================= */
function click_typ(typ) {
	if (typ == "レンタル予約")
	{
		/* 表示リスト */
		ids = new Array("must_h_tour", "must_member", "must_email_1", "must_zip_1", "must_add_1", "must_tel_1");
		names = new Array("must_name", "must_name2");
		
		/* 非表示リスト */
		exids = new Array("mailinfo", "must_birth_1", "must_faq");
		exnames = new Array();
	}
	
	else if (typ == "ツアー予約")
	{
		/* 表示リスト */
		ids = new Array("must_h_tour", "must_member", "mailinfo", "must_email_1", "must_zip_1", "must_add_1", "must_tel_1", "must_birth_1");
		names = new Array("must_name", "must_name2");
		
		/* 非表示リスト */
		exids = new Array("must_faq");
		exnames = new Array();
	}
	
	else if (typ == "お問い合わせ")
	{
		/* 表示リスト */
		ids = new Array("must_faq");
		names = new Array();
		
		/* 非表示リスト */
		exids = new Array("mailinfo", "must_h_tour", "must_member", "must_email_1", "must_zip_1", "must_add_1", "must_tel_1", "must_birth_1");
		exnames = new Array("must_name", "must_name2");
	}
	
	else
	{
		/* 表示リスト */
		ids = new Array();
		names = new Array();
		
		/* 非表示リスト */
		exids = new Array("mailinfo", "magarea", "must_email_1", "must_zip_1", "must_add_1", "must_tel_1", "must_birth_1", "must_faq");
		exnames = new Array("must_name", "must_name2");
	}

	/* 表示処理 */
	for (i=0; i<ids.length; i++) {
		try {
			document.getElementById(ids[i]).style.display = "inline";
		} catch(e) {
		}
	}
	for (i=0; i<names.length; i++) {
		try {
			obj = document.getElementsByName(names[i]);
			for (j=0; j<obj.length; j++) {
				obj[j].style.display = "inline";
			}
		} catch(e) {
		}
	}
	
	/* 非表示処理 */
	for (i=0; i<exids.length; i++) {
		try {
			document.getElementById(exids[i]).style.display = "none";
		} catch(e) {
		}
	}
	for (i=0; i<exnames.length; i++) {
		try {
			obj = document.getElementsByName(exnames[i]);
			for (j=0; j<obj.length; j++) {
				obj[j].style.display = "none";
			}
		} catch(e) {
		}
	}
}

/* ==============================
     予約人数変更処理
================================= */
function change_membernum() {
	document.getElementById('actionid').value='';
	document.form.submit();
}
