﻿//=== top用 JavaScript ===
var httpObj=null;
var aidLogo=0;
var aidTop=1;
var aidBrand=2;
var aidPrivacy=3;
var aidBrowseSpec=4;

// 全ﾉｰﾄﾞ削除
function clearBody() {
	var o = document.getElementById("idBody");
	try{
		while(o.all.length) o.removeChild(o.all(0));
	}catch(e){}
}

// Anchorにfocusを当てる
function focusAnchor(id) {
	try{
		document.links[id].blur();	//画面上の位置がズレている時があるので一度外してみる
		document.links[id].focus();
	}catch(e){}
}

// ﾄｯﾌﾟﾍﾟｰｼﾞ表示
function showTop() {
	clearBody();
	ht ='<embed src="share/flash/n2c.swf" quality=high width="420" height="290" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>';
	ht+='<div class="left"></div>';
	ht+='<div class="right"></div>';
	document.getElementById("idBody").innerHTML = ht;
	focusAnchor(aidTop);
}
// 著作権・商標ﾍﾟｰｼﾞ表示
function loadBrand() {
	clearBody();
	httpObj = createXMLHttpRequest(showBrand);
	if(httpObj){
		httpObj.open("GET","top.php?request=brand",true);
		httpObj.send(null);
	}
}
function showBrand() {
	if(statusXMLHttpRequest(httpObj)){
		document.getElementById("idBody").innerHTML = httpObj.responseText;
		focusAnchor(aidBrand);
	}else{
		document.getElementById("idBody").innerHTML = "<b>Loading...</b>";
	}
}
// 個人情報保護ﾍﾟｰｼﾞ表示
function loadPrivacy() {
	clearBody();
	httpObj = createXMLHttpRequest(showPrivacy);
	if(httpObj){
		httpObj.open("GET","top.php?request=privacy",true);
		httpObj.send(null);
	}
}
function showPrivacy() {
	if(statusXMLHttpRequest(httpObj)){
		document.getElementById("idBody").innerHTML = httpObj.responseText;
//		focusAnchor(aidPrivacy);
	}else{
		document.getElementById("idBody").innerHTML = "<b>Loading...</b>";
	}
}
// サイト閲覧仕様
function loadBrowseSpec() {
	clearBody();
	httpObj = createXMLHttpRequest(showBrowseSpec);
	if(httpObj){
		httpObj.open("GET","top.php?request=browse",true);
		httpObj.send(null);
	}
}
function showBrowseSpec() {
	if(statusXMLHttpRequest(httpObj)){
		document.getElementById("idBody").innerHTML = httpObj.responseText;
		focusAnchor(aidBrowseSpec);
	}else{
		document.getElementById("idBody").innerHTML = "<b>Loading...</b>";
	}
}
// Copyright
function loadCopyright() {
	httpObj = createXMLHttpRequest(showCopyright);
	if(httpObj){
		httpObj.open("GET","top.php?request=copyright",true);
		httpObj.send(null);
	}
}
function showCopyright() {
	if(statusXMLHttpRequest(httpObj)){
		document.getElementById("idCopyright").innerHTML = httpObj.responseText;
	}else{
		document.getElementById("idCopyright").innerHTML = "<b>Loading...</b>";
	}
}

function initPage() {
	// Head部(Logo部)
	ht ='<a href="./" onfocus="this.blur()"><img src="share/img/N2C.jpg" alt="N2C" width="100" height="60" /></a>';
	document.getElementById("idLogo").innerHTML = ht;
	// Head部(Tools部)
	ht ='';
	document.getElementById("idTools").innerHTML = ht;
	// Body部
	showTop();
	// Foot部(Safety部)
	//ht ='<img src="share/img/SSL50_logo.gif" alt="SSL" width="152" height="52" />';
	//ht ='<script src=https://seal.verisign.com/getseal?host_name=www.n2c.jp&size=M&use_flash=YES&use_transparent=YES&lang=ja></script>';
	//document.getElementById("idSafety").innerHTML = ht;
	// Foot部(Link部)
	ht ='<p>';
	ht+='<a href="" onclick="showTop(); return false;">トップページ</a><span class="sp"> | </span>';
	ht+='<a href="" onclick="loadBrand(); return false;">著作権・商標</a><span class="sp"> | </span>';
	ht+='<a href="" onclick="loadPrivacy(); return false;">個人情報保護</a><span class="sp"> | </span>';
	ht+='<a href="" onclick="loadBrowseSpec(); return false;">サイト閲覧仕様</a><span class="sp"> | </span>';
	ht+='<a href="private/">社内ページ</a>';
	ht+='</p>';
	document.getElementById("idLink").innerHTML = ht;
	// Foot部(Copyright部)
	loadCopyright();
}

