﻿// 2006/01/10 月次レポート・現在年月

var CurrentMonth = '2010年6月末';
var CurrentMonthNomura = '2010年6月末';

// 2006/01/25 ページフッター・コピーライト表記

var CopyrightYear = "2003-2010";



// 2008/1/ Popup Window
function openWin(tgt, width, height) {
			
			var pos = "";
			var features;
		
			browser = new Object();
			
			if(navigator.appName.indexOf("Netscape") != -1) {
				browser.isNetscape = true;
			} else if (navigator.appName.indexOf("Microsoft") != -1) {
				browser.isMicrosoft = true;
			}
			
			//var width = 800;
			//var height = 600;
			var fixWidth = 8;
			var fixHeight = 28;
			var screenHeight = screen.availHeight-fixHeight;
			var screenWidth = screen.availWidth-fixWidth;
			
			//get position of window based on browser
			if(browser.isNetscape) {
				pos = ",screenX="+(screenWidth - width)/2+",screenY="+(screenHeight - height)/2;
			} else {
				pos = ",left="+(screenWidth - width)/2+", top="+(screenHeight - height)/2;
			}
		
			features = "width="+width+",height="+height+pos+",scrollbars=no";
			
			//open new window			
			mainwindow = window.open(tgt,"new_window",features);
		
			if(mainwindow != null) {
				mainwindow.focus() ;
			}
	}
	
// 2008/1/ Popup Window
function openHP(tgt) {
			
			var pos = "";
			var features;
		
			browser = new Object();
			
			if(navigator.appName.indexOf("Netscape") != -1) {
				browser.isNetscape = true;
			} else if (navigator.appName.indexOf("Microsoft") != -1) {
				browser.isMicrosoft = true;
			}
			
			var width = 800;
			var height = 600;
			var fixWidth = 8;
			var fixHeight = 28;
			var screenHeight = screen.availHeight-fixHeight;
			var screenWidth = screen.availWidth-fixWidth;
			
			//get position of window based on browser
			if(browser.isNetscape) {
				pos = ",screenX="+(screenWidth - width)/2+",screenY="+(screenHeight - height)/2;
			} else {
				pos = ",left="+(screenWidth - width)/2+", top="+(screenHeight - height)/2;
			}
		
			features = "width="+width+",height="+height+pos+",scrollbars=yes";
			
			//open new window			
			mainwindow = window.open(tgt,"new_window",features);
		
			if(mainwindow != null) {
				mainwindow.focus() ;
			}
	}

//2007/10 pop test
function pop(tgt) {
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="205" height="148" id="oogiri" align="middle">');
document.write('<param name="allowScriptAccess" value="sameDomain" />');
document.write('<param name="movie" value="/pop.swf" />');
document.write('<param name="quality" value="high" />');
document.write('<param name="wmode" value="transparent" />');
document.write('<param name="bgcolor" value="#ffffff" />');
document.write('<param name="FlashVars" value="TGT='+tgt+'" />');
document.write('<embed src="/pop.swf" quality="high" wmode="transparent" bgcolor="#ffffff"  FlashVars="TGT='+tgt+'" width="205" height="148" name="oogiri" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
}

//list_teishiのリンククリック時にクッキーを保存
function setTgt(fn) {
   createCookie("fname", fn, 365);
}

//historyのリンククリック時にクッキーを保存
function clickHis() {
	var cookie = readCookie("his");
	if(cookie){
		openWin('/about/history.html',800,600)
	}else{
		openWin('/about/history_pre.html',800,600)
	}
   createCookie("his", true, 365);
}

// 2007/7/ hanbai-teishi tab
function def_tei(){
	var cookie = readCookie("ttab");
  	var tgtid = cookie ? cookie : "sec1";
	document.getElementById(tgtid).className="on";
	//alert(tgtid);
}

function setOn_tei(tgt) {
		//document.cookie = "ttab=" + tgt.id;
		createCookie("ttab",tgt.id,1)
		tgt.className="on";
		for (i = 1; i<=6; i++){
			if(tgt==document.getElementById('sec'+ i)){
			document.getElementById('sec'+ i).className="on";
			}else{
			document.getElementById('sec'+ i).className="off";
			}
		}
		var uName = navigator.userAgent;
		if (uName.indexOf("Safari") > -1) {
		var w=window.outerWidth;
		var h=window.outerHeight;
		window.resizeTo(w-1,h);
		}
}

// 2006/12 CSS Changer (font size)

function setActiveStyleSheet(title) {
  var i, a, main;
  //alert(title);
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) {
      	a.disabled = false;
      	}
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return "Small";
  //return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return "Small";
  //return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);

// ########## お気に入り追加（windows版IEのみ）
var win = (navigator.userAgent.indexOf('Win') != -1 || navigator.userAgent.indexOf('win') != -1);
function addFav(URL, PageTitle) {
	if(win && document.all) {
		window.external.AddFavorite(URL, PageTitle);
	} else {
		alert("この機能をご利用になるには、windows版のInternet Explororをご使用ください。");
	}
}

//背景画像の切り替え
function changeBK(num) {
		a=Math.floor(Math.random()*num)+1;
		document.getElementsByTagName('body')[0].className="style"+a;
}

//ヘッダ用flash（前ページ共通で使用）
function head_fla() {
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="400" height="68" id="headfla" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="allowFullScreen" value="false" />');
	document.write('<param name="movie" value="/headfla.swf" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value="#ffffff" />');
	document.write('<embed src="/headfla.swf" quality="high" bgcolor="#ffffff" width="400" height="68" name="headfla" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

function head_flaXX() {
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="400" height="68" id="headfla" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="allowFullScreen" value="false" />');
	document.write('<param name="movie" value="http://sub.nenkin.bz/headfla.swf" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value="#ffffff" />');
	document.write('<embed src="http://sub.nenkin.bz/headfla.swf" quality="high" bgcolor="#ffffff" width="400" height="68" name="headfla" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}


//swfとの交信
function thisMovie(movieName) {
　　var isIE = navigator.appName.indexOf("Microsoft") != -1;
　　return (isIE) ? window[movieName] : document[movieName];
}

function stop_flashes(flg) {
	/*thisMovie("headfla").stop_flash(flg);*/
	if(flg){
		document.getElementById("head_fla").className="hide";
	}else{
		document.getElementById("head_fla").className="unhide";
	}
}



/* Smooth scrolling
   Changes links that link to other parts of this page to scroll
   smoothly to those links rather than jump to them directly, which
   can be a little disorienting.
   
   sil, http://www.kryogenix.org/
   
   v1.0 2003-11-11
   v1.1 2005-06-16 wrap it up in an object
*/

var ss = {
  fixAllLinks: function() {
    // Get a list of all links in the page
    var allLinks = document.getElementsByTagName('a');
    // Walk through the list
    for (var i=0;i<allLinks.length;i++) {
      var lnk = allLinks[i];
      if ((lnk.href && lnk.href.indexOf('#') != -1) && 
          ( (lnk.pathname == location.pathname) ||
	    ('/'+lnk.pathname == location.pathname) ) && 
          (lnk.search == location.search)) {
        // If the link is internal to the page (begins in #)
        // then attach the smoothScroll function as an onclick
        // event handler
        ss.addEvent(lnk,'click',ss.smoothScroll);
      }
    }
  },

  smoothScroll: function(e) {
    // This is an event handler; get the clicked on element,
    // in a cross-browser fashion
    if (window.event) {
      target = window.event.srcElement;
    } else if (e) {
      target = e.target;
    } else return;

    // Make sure that the target is an element, not a text node
    // within an element
    if (target.nodeName.toLowerCase() != 'a') {
      target = target.parentNode;
    }
  
    // Paranoia; check this is an A tag
    if (target.nodeName.toLowerCase() != 'a') return;
  
    // Find the <a name> tag corresponding to this href
    // First strip off the hash (first character)
    anchor = target.hash.substr(1);
    // Now loop all A tags until we find one with that name
    var allLinks = document.getElementsByTagName('a');
    var destinationLink = null;
    for (var i=0;i<allLinks.length;i++) {
      var lnk = allLinks[i];
      if (lnk.name && (lnk.name == anchor)) {
        destinationLink = lnk;
        break;
      }
    }
    if (!destinationLink) destinationLink = document.getElementById(anchor);

    // If we didn't find a destination, give up and let the browser do
    // its thing
    if (!destinationLink) return true;
  
    // Find the destination's position
    var destx = destinationLink.offsetLeft; 
    var desty = destinationLink.offsetTop;
    var thisNode = destinationLink;
    while (thisNode.offsetParent && 
          (thisNode.offsetParent != document.body)) {
      thisNode = thisNode.offsetParent;
      destx += thisNode.offsetLeft;
      desty += thisNode.offsetTop;
    }
  
    // Stop any current scrolling
    clearInterval(ss.INTERVAL);
  
    cypos = ss.getCurrentYPos();
  
    ss_stepsize = parseInt((desty-cypos)/ss.STEPS);
    ss.INTERVAL =
setInterval('ss.scrollWindow('+ss_stepsize+','+desty+',"'+anchor+'")',10);
  
    // And stop the actual click happening
    if (window.event) {
      window.event.cancelBubble = true;
      window.event.returnValue = false;
    }
    if (e && e.preventDefault && e.stopPropagation) {
      e.preventDefault();
      e.stopPropagation();
    }
  },

  scrollWindow: function(scramount,dest,anchor) {
    wascypos = ss.getCurrentYPos();
    isAbove = (wascypos < dest);
    window.scrollTo(0,wascypos + scramount);
    iscypos = ss.getCurrentYPos();
    isAboveNow = (iscypos < dest);
    if ((isAbove != isAboveNow) || (wascypos == iscypos)) {
      // if we've just scrolled past the destination, or
      // we haven't moved from the last scroll (i.e., we're at the
      // bottom of the page) then scroll exactly to the link
      window.scrollTo(0,dest);
      // cancel the repeating timer
      clearInterval(ss.INTERVAL);
      // and jump to the link directly so the URL's right
      location.hash = anchor;
    }
  },

  getCurrentYPos: function() {
    if (document.body && document.body.scrollTop)
      return document.body.scrollTop;
    if (document.documentElement && document.documentElement.scrollTop)
      return document.documentElement.scrollTop;
    if (window.pageYOffset)
      return window.pageYOffset;
    return 0;
  },

  addEvent: function(elm, evType, fn, useCapture) {
    // addEvent and removeEvent
    // cross-browser event handling for IE5+,  NS6 and Mozilla
    // By Scott Andrew
    if (elm.addEventListener){
      elm.addEventListener(evType, fn, useCapture);
      return true;
    } else if (elm.attachEvent){
      var r = elm.attachEvent("on"+evType, fn);
      return r;
    } else {
      alert("Handler could not be removed");
    }
  } 
}

ss.STEPS = 25;

ss.addEvent(window,"load",ss.fixAllLinks);
