/*----------------------------------------------------------
    frame.js  for http:www.sanshiro.ne.jp/
    
    set frame pages(navigation and main contents)
    
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
how to use :
(1) change_page() : 
  You don't have to write this function.
  If you will link to any page with frame(and upper navigation bar), just link as follows.
  
    <a href="[path to the frame.htm]?[path to the target URL]" target="_top">***</a>
    
      [path to the frame.htm]
          path to the target category directory's frame.htm file
      [path to the target URL]
          relative path to the target URL from the frame.htm above.
    
      e.g :
        (if current directory is http://www.sanshiro.ne.jp/info/01/)
        <a href="../../activity/frame.htm?01/k01/index.htm" target="_top">index.htm</a>
        
(2)checkFrameName()
  All pages have this function to set frame(for view navigation bar) from other web sites
  like Yahoo!. Refreshing to the frame.htm to set frame, so it is better to link frame.htm
  directory (read above(1)) than to link just the page which is set 'main' frame.
  
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
    version 1.12 last update 2001/11/07
    by Etsushi Kojima   etsushi@ylw.mmtr.or.jp
    (and S.Kamio)
----------------------------------------------------------*/
function change_page(target){//v1.0 (01/03/30)
	var mainSrc = location.search;
	if( mainSrc.charAt(0) == '?' ){
		mainSrc = mainSrc.substring(1,mainSrc.length);
	} else {
		mainSrc = 'main.htm';
	}
	if(target) target.location.replace(mainSrc);
}

/*-------------------------
  フレーム内ページを読み込ん場合、
  ナビゲーションバーを表示
---------------------------*/
function checkFrameName(name){//ver1.0
	return;
	if(window.name != name){
		var nav = new Array('about', 'activity', 'e-century', 'reference', 'event', 'talk', 'bbs', 'augury', 'info');
		var dir, url = location.href;
		for(i in nav){
			if(url.indexOf(nav[i]) > -1){
				dir = nav[i]; break;
			}
		}
		if(url.indexOf('google') > -1) return; //とりあえずgoogleのcacheでの無限ループ防止。
		if(dir == null) return;//一応
		var newUrl  = url.substring(0, url.indexOf(dir)) + dir + '/frame.htm?';
		    newUrl += url.substring(url.indexOf(dir) + dir.length + 1);
		loop += 1;
		window.open(newUrl, '_top');
	}
}

