// JavaScript Document


//プルダウン

var d = document, dE = d.documentElement;
var fixIEwidth = 0;


function menuHover() {
	if (! d || ! d.getElementById("navigation")) {
		return;
	}
	var menuItems = d.getElementById("navigation").getElementsByTagName("li");

	for (var i = 0, miL = menuItems.length; i < miL; i++) {
		menuItems[i].onmouseover = function() {
			this.className = "mnhover";
		}
		menuItems[i].onmouseout = function() {
			this.className = "";
		}

		// Add alpha transparencey in IE 5.5+
		var hasSub = menuItems[i].getElementsByTagName("ul")[0];
		if (hasSub && (typeof hasSub.filters == "object")) {
			hasSub.style.filter = "alpha(opacity=100)";
		}
	}
}

window.onload = function(e) {
	if (d.getElementById) {
		if (d.all) {
			menuHover();
		}
		// Opera wont switch css sometimes unless we do it onload! POS!
		if (navigator.userAgent.indexOf('Opera') != -1) {
			init();
			//alert("Your browser c");
		}
	}
};



//shadowboxとその他のjavascriptを共存させるために使う


var Shadowbox;

if(Shadowbox){

Shadowbox.loadSkin('classic', '../js/skin');
Shadowbox.loadLanguage('en', '../js/lang');
Shadowbox.loadPlayer(['flv', 'html', 'iframe', 'img', 'qt', 'swf', 'wmp'], '../js/player');

window.onload = function(e) {
	if (d.getElementById) {
		if (d.all) {
			menuHover();
		}
		// Opera wont switch css sometimes unless we do it onload! POS!
		if (navigator.userAgent.indexOf('Opera') != -1) {
			init();
			//alert("Your browser c");
		}
	}
		Shadowbox.init();
};
}



//ツリーメニュー


function exMenu(tName)
{
	tMenu = document.getElementById(tName).style;
	if (tMenu.display == 'none') tMenu.display = "block"; else tMenu.display = "none";
}




// Form Input Check ---------------------- START ------------------------

function Chk_email(Adr) {
	if ((Adr == "") || (Adr.indexOf ('@') == -1) || (Adr.lastIndexOf ('.') <= Adr.indexOf ('@')) || (Adr.indexOf ('.') == -1)) {
		return false;
	} else {
		return true;
	}
}


function checkForm(){
	Chkflg=true;
	elm1=document.contactForm.name.value;
	
	
	if(elm1=="") {
		Chkflg=false;
		alert('『お名前』が入力されていません。\n入力内容をご確認ください');
		return Chkflg;
	}
	if(!Chk_email(document.contactForm.Email.value)) {
		Chkflg=false;
		alert('『メールアドレス』が入力されていないか、間違っています。\n入力内容をご確認ください。');
		return Chkflg;
	}
	return Chkflg;
}




// Form Input Check ---------------------- END ------------------------



/*
function initTreeMenu() {
var t = document.getElementById('treemenu');
var c = t.childNodes;
var a = new Array();

for(var i = 0, j = c.length; i < j; i++) {
if(c[i].nodeName == 'LI') {
a.push(c[i]);
}
}

for(var k = 0; k < a.length; k++) {
var cookie = getCookie('s' + k);
if(cookie == 1) {
a[k].getElementsByTagName('UL')[0].style.display = 'none';
}
}
}

function setTreeMenu(e) {
var t = e.target || e.srcElement;

if(getID(t) && getSwitch(t)) {
var u = getBrosUL(t);
var n = countPrevious(getParentLI(t));

if(u.style.display == '' || u.style.display == 'block') {
u.style.display = 'none';
setCookie('s' + n, 1, new Date(2050,0,1));
}
else if(u.style.display == 'none') {
u.style.display = 'block';
setCookie('s' + n, 0, new Date(2050,0,1));
}
}
}

function getID(x) {
return x ? (x.id == 'treemenu') ? x : arguments.callee(x.parentNode) : null;
}

function getSwitch(x) {
return x ? (x.className == 'switch') ? x : arguments.callee(x.parentNode) : null;
}

function getParentLI(x) {
return x ? (x.nodeName == 'LI') ? x : arguments.callee(x.parentNode) : null;
}

function getBrosUL(x) {
return x ? (x.nodeName == 'UL') ? x : arguments.callee(x.nextSibling) : null;
}

function countPrevious(x) {
var n = 0;
while(x.previousSibling) {
if(x && x.previousSibling) x = x.previousSibling;
if(x.nodeType == 1) n++;
}
return n;
}

function setCookie(n, v, e, p, d, s) {
var c = [encodeURIComponent(n) + '=' + encodeURIComponent(v)];

if (e instanceof Date) {
c.push ('expires=' + e.toUTCString());
} else if (e) {
c.push ('expires=' + expires);
}

if(p) c.push('path=' + encodeURI(p));
if(d) c.push('domain=' + encodeURI(d));
if(s) c.push('secure');

document.cookie = c.join('; ');
}

function getCookie(n) {
var v = document.cookie.match(RegExp(decodeURIComponent(n) + '=(.*?)(?:;|\s*$)'));
return v ? decodeURIComponent(v[1]) : '';
}

if(window.addEventListener) {
window.addEventListener('DOMContentLoaded', initTreeMenu, false);
document.addEventListener('click', setTreeMenu, false);
}
else if(window.attachEvent) {
initTreeMenu();
document.attachEvent('onclick', setTreeMenu);
}
*/
