// 文字コード自動判定用コメント

// Initialize
var IE7 = (typeof document.documentElement.style.msInterpolationMode != "undefined") ? true : false;
var IE5 = (navigator.userAgent.indexOf('MSIE 5') != -1);
var IE6 = (!IE7 && !IE5 && window.ActiveXObject) ? true : false;
var FX = (navigator.userAgent.indexOf('Firefox') != -1);
var SF = (navigator.userAgent.indexOf('Safari') != -1);
var SF2 = (SF && navigator.appVersion.indexOf('Version/') == -1);
var Mac = (navigator.userAgent.indexOf('Mac') != -1);

var selectMenu = 0;
var ci = 0;
var oi = 0;

// fontsize
var fontSize = 'small';
if (FX || SF) fontSize = '12px';
if (IE5) fontSize = 'x-small';
document.write('<style type="text/css"> body {');
document.write('font-size: ' + fontSize + ';');
document.write('}</style>');

function disp(n) {
	var menuList = document.getElementById('menu').getElementsByTagName('A');
	selectMenu = (selectMenu == n) ? 0 : n;
	for (var i = 1; i <= 3; i++) {
		menuList[i].className = (i == selectMenu) ? 'on' : '';
		document.getElementById('C' + i).style.display = (i == selectMenu) ? 'block' : 'none';
	}
	document.getElementById('C0').style.display = (selectMenu == 0) ? 'block' : 'none';
	setOpacity(document.getElementById('C' + selectMenu), 0);
	clearTimeout(ci);
	oi = 0;
	fade();
}
function fade() {
	setOpacity(document.getElementById('C' + selectMenu), ++oi / 10);
	if (oi < 10) ci = setTimeout(fade, 50);
}
function setOpacity(obj, n) {
	if (typeof obj.style.opacity !== "undefined") {
		obj.style.opacity = n;
	} else if (typeof obj.filters !== "undefined") {
		if (obj.filters.alpha) {
			obj.filters.alpha.opacity = n * 100;
		} else {
			obj.style.filter = "alpha(opacity=" + (n * 100) + ")";
		}
	}
}

function dispGMap() {
	window.onunload = GUnload;
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById('gmap'));
		map.addControl(new GSmallZoomControl());
		map.setCenter(new GLatLng(35.5,138.45), 7);
		var icon = new GIcon();
		icon.image = "http://setitup.jp/image/marker_icon.png";
		icon.shadow = "http://setitup.jp/image/marker_shadow.png";
		icon.iconSize = new GSize(52, 23);
		icon.shadowSize = new GSize(52, 23);
		icon.iconAnchor = new GPoint(0, 19);
		icon.infoWindowAnchor = new GPoint(20, 59);
		marker1 = new GMarker(new GLatLng(35.692378,139.738777), icon);

		GEvent.addListener(marker1, "click", gmap1);

		map.addOverlay(marker1);

	}
}
function gmap1() {
	map.setCenter(new GLatLng(35.6918,139.737318), 16);
	return false;
}

function chkForm() {
	F = document.ask;
	var s = '';
	var s2 = '';
	if (F.mail.value == "") {
		if (!s) F.mail.focus();
		F.mail.style.backgroundColor = "#FEE";
		s += "メールアドレス・";
	} else {
		if (!F.mail.value.match(/^[\w\-\.]+@[\w\-\.]+\.[\w]+$/)) { 
			if (!s) F.mail.focus();
			F.mail.style.backgroundColor = "#FEE";
			s2 += "メールアドレスの記述に誤りがあります。\n";
		}
	}
	if (F.subject.value == "") {
		if (!s) F.subject.focus();
		F.subject.style.backgroundColor = "#FEE";
		s += "サブジェクト・";
	}
	if (F.comment.value == "") {
		if (!s) F.comment.focus();
		F.comment.style.backgroundColor = "#FEE";
		s += "内容・";
	}
	if (F.comment.value.length > 250) {
		if (!s) F.comment.focus();
		F.comment.style.backgroundColor = "#FEE";
		s2 += "内容は250字以内でご記入ください。\n";
	}
	if (s) {
		alert(s.substring(0, s.length - 1) + 'を、入力してください。\n' + s2);
	} else {
		if (s2) alert(s2);
	}
	return (s || s2) ? false : true;
}
