
var faith_config = {version:8, play:false , plugin:(navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0};

if (faith_config.plugin) {
	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	for (var i = 0; i < words.length; ++i){
		if (isNaN(parseInt(words[i])))
			continue;
		var ver = words[i]; 
	}
	faith_config.play = ver >= faith_config.version;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('faith_config.play = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & faith_config.version)))\n');
	document.write('</SCR' + 'IPT\> \n');
}

var faith = {
	loadSWF: function(id,src,width,height,ver){
		if(faith_config.play){
			var html = '<OBJ'+'ECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="'+id+'" WIDTH="'+width+'" HEIGHT="'+height+'">'+
					'<PA'+'RAM NAME=movie VALUE="'+src+'">'+
					'<PA'+'RAM NAME=loop VALUE=true>'+
					'<PA'+'RAM NAME=quality VALUE=high>'+
					'<EM'+'BED name="'+id+'" src="'+src+'" loop="true" quality="high" swLiveConnect="FALSE" WIDTH="'+width+'" HEIGHT="'+height+'" TYPE="application/x-shockwave-flash">'+
					'</EM'+'BED></OB'+'JECT>';
			document.write(html);
		}else{
			document.write('<div class="impossible-load-flash">');
			document.write('<div class="flash-link">');
			document.write('<a href="http://www.adobe.com/shockwave/download/index.cgi?Lang=Japanese&P5_Language=Japanese&P1_Prod_Version=ShockwaveFlash&Lang=Japanese&" target="_blank"><span>Download Flash Player</span></a>');
			document.write('</div>');
			document.write('<div class="flash-exp">');
			document.write('当サイトはFlashコンテンツを使用しております。<br>');
			document.write('快適にページをご覧頂く為、お手数ですが最新のFlash Player(バージョン8以上)をダウンロードして下さい。<br>');
			document.write('</div>');
			document.write('</div>');
		}
	}
};

faith.content = {
	isnull:function(obj,name){
		if(obj.value==""){
			alert(name+"を入力してください。");
			obj.focus();
			return false;
		}
		return true;
	},

	issame:function(){
		args = $A(arguments), value=args.shift(), ret=true;
		args.each(function(ag){
			if(value!=ag) ret=false;
		});
		return ret;
	},

	ischecked: function(obj){
		if(obj && obj.length && obj.length>1){
			obj.each(function(obj){
				if(obj.checked) return true;
			});
			return false;
		}else{
			return obj.checked;
		}
	}
}

faith.content.subscribe = Object.extend(Object.extend({},faith.content), {
	check: function(form){
		if(!this.isnull(form.name, 'お名前')) return false;
		if(!this.isnull(form.kana, 'お名前(カナ)')) return false;
		if(!this.isnull(form.mail, 'メールアドレス')) return false;
		if(!this.isnull(form.mail2, 'メールアドレス(確認用)')) return false;
		if(!this.issame(form.mail.value , form.mail2.value)){
			alert("入力されたメールアドレスを確認して下さい。");
			return false;
		}
		if(!this.isnull(form.zip1, '郵便番号')) return false;
		if(!this.isnull(form.zip2, '郵便番号')) return false;
		if(!this.isnull(form.address, '都道府県')) return false;
		if(!this.isnull(form.address2, '住所')) return false;
		if(!this.isnull(form.mobile, '携帯電話番号')) return false;
		if(!this.isnull(form.tel, 'ご自宅の電話番号')) return false;
		if(!this.isnull(form.month1, '第一希望日')) return false;
		if(!this.isnull(form.day1, '第一希望日')) return false;
		if(!this.isnull(form.hour1, '第一希望日')) return false;
		return confirm('オンライン予約を行います。よろしいですか？');
	}
});

faith.content.contact = Object.extend(Object.extend({},faith.content), {
	check: function(form){
		if(!this.isnull(form.name, 'お名前')) return false;
		if(!this.isnull(form.mail, 'メールアドレス')) return false;
		if(!this.isnull(form.mail2, 'メールアドレス(確認用)')) return false;
		if(!this.issame(form.mail.value , form.mail2.value)){
			alert("入力されたメールアドレスを確認して下さい。");
			return false;
		}
		if(!this.isnull(form.comment, 'お問い合わせ内容')) return false;
		return confirm('お問合わせを送信します。よろしいですか？');
	}
});




Event.observe(window, "load", function(){
	$A(document.getElementsByClassName('p_help')).each(
		function(dom)
		{
			dom.style.position = "relative";
			var ch = dom.childNodes;
			if(ch.length < 2) return;
			var msg = ch[1];
			Object.extend(msg.style,
				{"position":"absolute", "display":"none", "left":"0px", "border":"1px solid", "backgroundColor":"#FFD"}					  
			)
			msg.style.position="absolute";
			msg.style.display="none";
			msg.style.left = "0px";
			
			Event.observe(dom, "mouseover", function(e)
			{
				dom.style.cursor = "default";
				msg.style.display = "block";
			});
			Event.observe(dom, "mouseout", function(e)
			{
				msg.style.display = "none";
			});
			
		}
	);
	$A(document.getElementsByClassName('m_over_step2')).each(
		function(dom)
		{
			dom.title = dom.innerText;
			dom.innerHTML = "";
			Event.observe(dom, "mouseover", function(e)
			{
				Event.element(e).style.backgroundPosition = 'center 100%'; 
			});
			Event.observe(dom, "mouseout", function(e)
			{
				Event.element(e).style.backgroundPosition = 'center top'; 
			});
		}
	);

	$A(document.getElementsByClassName('m_over_step3')).each(
		function(dom)
		{
			if(dom.className.indexOf("cur_") == -1){
				Event.observe(dom, "mouseover", function(e)
				{
					Event.element(e).style.backgroundPosition = 'center 50%'; 
				});
				Event.observe(dom, "mouseout", function(e)
				{
					Event.element(e).style.backgroundPosition = 'center top'; 
				});
			}else{
				dom.style.backgroundPosition = 'center 100%';
			}
		}
	);
/*
	$A(document.getElementsByClassName('m_over_step4')).each(
		function(dom)
		{
			
			if(dom.className.indexOf("n_a") == -1){
				if(dom.className.indexOf("cur_") == -1){
					//リンク有効
					
					Event.observe(dom, "mouseover", function(e)
					{
						Event.element(e).style.backgroundPosition = 'left 33%'; 
					});
					Event.observe(dom, "mouseout", function(e)
					{
						Event.element(e).style.backgroundPosition = 'center top'; 
					});
				}else{
					dom.style.backgroundPosition = 'left 66%';
				}
			}else{
				//リンク無効
				dom.style.backgroundPosition = 'left 100%';
			}
		}
	);
*/	
	
});



