/*
File: common.js
Date: 2007/10/03
Script by Kenichi Hamada, Yoshihiro Hirai
javascript commonfile for bitstep-web
*/


/*--------------------------------
  header
--------------------------------*/
function header(pos) {
	var list  = new Array("index","oshirase","works","company","recruit","contact","contact_form");

	if (pos=="contact_form") { path = "../../" } else { path = "./" };
	document.write('<div id="header">');
	document.write('<a href="',path,'index.html">');
  for (i = 0; i < list.length; i++) {
		if (pos == list[i]) {
			//現在地表示
			document.write('<img src="',path,'img/title/title_',list[i],'.gif" alt="bitstep Title Logo" width="760" height="65" />');
		}
	}
	//document.write('<img src="',path,'img/title.gif" alt="bitstep Logo" width="760" height="65" />');
	document.write('</a>');
	document.write('</div>');
}

/*--------------------------------
  navigation
--------------------------------*/
function navi(pos) {
	if (pos == "contact_form") {
			//メールフォーム位置向け
			var index = new Array("トップ","お知らせ","制作実績","会社概要","求人案内","研究所","お問い合わせ","ツイッター");
			var list  = new Array("index","oshirase","works","company","recruit","labo","contact_form","twitter");
	} else {
			var index = new Array("トップ","お知らせ","制作実績","会社概要","求人案内","研究所","お問い合わせ","ツイッター");
			var list  = new Array("index","oshirase","works","company","recruit","labo","contact","twitter");
	}

	if (pos == "contact_form") { path = "../../"; } else { path = "./" }
	document.write('<div id="navi">');
  for (i = 0; i < list.length; i++) {
		if (pos == list[i]) {
			//現在地表示
				navi_index = "<a href=\"" + path + list[i] + ".html\" class=\"genzai\">" + index[i] + "</a>";
		} else {
			//非選択
			navi_index = "<a href=\"" + path + list[i] + ".html\">" + index[i] + "</a>";
			if (list[i] == "labo") {
				//研究所直接リンク
				navi_index = "<a href=\"http://www.bitstep.jp/laboratory/\">" + index[i] + "</a>";
			}
			else if (list[i] == "twitter") {
				//ツイッター直接リンク
				navi_index = "<a href=\"http://twitter.com/bitstep\" target=\"_blank\">" + index[i] + "</a>";
			}
		}
		document.write(navi_index);
	}
	document.write('</div>');
}

/*--------------------------------
  copyright
--------------------------------*/
function footer() {
	document.write('<div id="footer">');
		var refer = document.referrer;
		document.write("<a href='http://nakanohito.jp/'>");
		document.write("<img src='http://nakanohito.jp/an/?u=100359&h=386634&w=48&guid=ON&t=&version=js&refer="+escape(parent.document.referrer)+"&url="+escape(parent.document.URL)+"' border='0' width='48' height='48' />");
		document.write("</a>");
		document.write("<p>");
		document.write('当サイトにある画像、文章、及びデータの無断転用、転載を固く禁じさせて頂きます<br />');
		document.write('Copyright&nbsp;&copy;&nbsp;2002-2009&nbsp;bitstep&nbsp;Co.,Ltd.&nbsp;All&nbsp;rights&nbsp;reserved.');
		document.write("<p>");
 	document.write('</div>');
}


/*--------------------------------
  創業してから何日目？
--------------------------------*/
function passtime() {
	var birthY = 2002;
	var birthM = 3;
	var birthD = 25;

	myNow   = new Date();
	myBirth = new Date( birthY , birthM -1 , birthD );
	myMsec = myNow.getTime()-myBirth.getTime();
 	myDay = Math.floor(myMsec / (1000*60*60*24));

  countYear = Math.floor(myDay / 365 );
	countDay  = myDay - countYear * 365 + 1;
	document.write("&nbsp;（今日で創業",countYear,"年",countDay,"日目です）");
	//document.write("&nbsp;(今日で創業",myDay+1,"日目です)");
}
