//---------------------------------------------------
// Cookieから値を取得
//---------------------------------------------------
function _getCookie(key){
   _tmp=document.cookie+";";
   _tmp1=_tmp.indexOf(key,0);
   if (_tmp1!=-1){
      _tmp=_tmp.substring(_tmp1,_tmp.length);
      _start=_tmp.indexOf("=",0)+1;
      _end=_tmp.indexOf(";",_start);
      _ret =(unescape(_tmp.substring(_start,_end)));
   }else{
      _ret = "";
   }
   return _ret;
}

//---------------------------------------------------
// Cookieに値をセット
//---------------------------------------------------
function _setCookie(key,value){
   _tmp=key+"="+escape(value)+";";
   _tmp+="expires=Fri, 31-Dec-2030 23:59:59";
   document.cookie=_tmp;
}

//---------------------------------------------------
// Cookieに値をセット（有効期限７日間）
//---------------------------------------------------
function _setCookie_Save7Days(key,value){
  _tmp=key+"="+escape(value)+";";
  expiresDate=new Date();
  expiresDate.setTime(expiresDate.getTime()+60*60*24*7*1000);
  _tmp+="expires="+expiresDate.toGMTString();
  document.cookie=_tmp;
}

//---------------------------------------------------
// Cookieを削除
//---------------------------------------------------
function _delCookie(key){
  expiresDate=new Date();
  expiresDate.setYear(expiresDate.getYear()-1);
  _tmp=key+"=;"+"expires="+expiresDate.toGMTString();
  document.cookie=_tmp;
}

//---------------------------------------------------
// ブラウザのバージョン取得
//---------------------------------------------------
function _getBrowserver(){
    _useragent=navigator.userAgent;
    if (_useragent.indexOf('MSIE 5.')>=0){
       _ret="IE5.x";
    }else if (_useragent.indexOf('MSIE 4.')>=0){
       _ret="IE4.x";
    }else if (_useragent.indexOf('MSIE 3.')>=0){
       _ret="IE3.x";
    }else if (_useragent.indexOf('Mozilla/4.')>=0){
       _ret="NN4.x";
    }else if (_useragent.indexOf('Mozilla/3.')>=0){
       _ret="NN3.x";
    }else{
       _ret=""; 
    }
    return _ret;
}

//---------------------------------------------------
// ブラウザのタイプを取得
//---------------------------------------------------
function _getBrowsertype(){
    _useragent=navigator.userAgent;
    if (_useragent.indexOf('MSIE')>=0){
        return "IE";
    }else if (_useragent.indexOf('Mozilla')>=0){
        return "NN";
    }else{
        return ""; 
    }
}

//---------------------------------------------------
// URLからファイル名を除去
//---------------------------------------------------
function _StripFileName(url)
{
	if (_getBrowsertype()=="IE"){
		_num=url.lastIndexOf("\\");
		if (_num==-1){
			_num=url.lastIndexOf("/");
		}
	}else{
		_num=url.lastIndexOf("/");
	}
	if (_num==-1){
		return "";
	}
	_path=url.substr(0,_num+1);
	return _path
}

//---------------------------------------------------
// URLからファイル名を取得
//---------------------------------------------------
function _MakeFileName(url)
{
	if (_getBrowsertype()=="IE"){
		_num=url.lastIndexOf("\\");
		if (_num==-1){
			_num=url.lastIndexOf("/");
		}
	}else{
		_num=url.lastIndexOf("/");
	}
	if (_num==-1){
		return "";
	}
	_file=url.substr(_num+1,url.length);
	return _file
}

//---------------------------------------------------
// URLからファイル名の拡張子部分を削除
//---------------------------------------------------
function _StripExtentName(url)
{
	_num=url.lastIndexOf(".");
	if (_num==-1){
		return "";
	}
	_str=url.substr(0,_num);
	return _str
}

//---------------------------------------------------
// JavaScript Tipsのサンプルページへのリンク出力
//---------------------------------------------------
function _jvsSampleJump(url)
{
	_file=_MakeFileName(url);
	_file=_StripExtentName(_file);
	_file=_file+"s.htm";
	document.write("<FONT size=2>");
	document.write("<A href='../jvstips/jvssample/"+_file+"'>サンプル</A>");
	document.write("</FONT>");
}

//---------------------------------------------------
// Visual Basic Tipsのダウンロードリンク出力
//---------------------------------------------------
function _vbtipsSampleDownLoad(url,ver)
{
	_file=_MakeFileName(url);
	_file=_StripExtentName(_file);
	_file=_file+".LZH";
	document.write("<FONT size=2>");
	document.write("<A href='../vbtips/lzh/"+_file+"'>DownLoad</A>");
	document.write("&nbsp;");
	document.write(_file+"\(VB"+ver+"\)");
	document.write("</FONT>");
}

//---------------------------------------------------
// 各Tipsページの「戻る」リンク出力
//---------------------------------------------------
function _ReverselinksWrite()
{
	document.write("<FONT size=2>");
	document.write("<A href='../index.html'>Home</A>");
	document.write("<span> | </span>");
	document.write("<A href='../vbtips/vbtips000.htm'>VisualBasic Tips</A>");
	document.write("<span> | </span>");
	document.write("<A href='../vbatips/vbatips000.htm'>VBA Tips</A>");
	document.write("<span> | </span>");
	document.write("<A href='../jvstips/jvs000.htm'>JavaScript Tips</A>");
	document.write("<span> | </span>");
	document.write("<A href='../bcbtips/bcbtips000.htm'>C++Builder Tips</A>");
	document.write("</FONT>");

}

//---------------------------------------------------
// 各ページの最下段
//---------------------------------------------------
function _BottomWrite()
{

	//サーチボックス
	//document.write("<iframe src=http://rcm-jp.amazon.co.jp/e/cm?t=tipsdance-22&o=9&p=20&l=qs1&f=ifr width=120 height=90 frameborder=0 scrolling=no></iframe>")
	//サーチボックス（ドロップダウン）
	//document.write("<iframe src=http://rcm-jp.amazon.co.jp/e/cm?t=tipsdance-22&o=9&p=27&l=qs1&f=ifr width=180 height=150 frameborder=0 scrolling=no></iframe>");
	//イージーバナー
	//document.write("<iframe src=http://rcm-jp.amazon.co.jp/e/cm?t=tipsdance-22&o=9&p=13&l=ur1&category=computerinternetbooks&banner=0VS5BBRF0XHDCN8XYG82&f=ifr width=468 height=60 scrolling=no border=0 marginwidth=0 style=border:none; frameborder=0></iframe>");
	//ライブリンク　サイズ: 468 x 60
	document.write("<iframe src=http://rcm-jp.amazon.co.jp/e/cm?t=tipsdance-22&o=9&p=13&l=bn1&mode=books-jp&browse=466298&=1&fc1=&lt1=&lc1=&bg1=&f=ifr marginwidth=0 marginheight=0 width=468 height=60 border=0 frameborder=0 style=border:none; scrolling=no></iframe>");
	document.write("<hr>");

	document.write("<address>");
	document.write("<center><FONT size=2>");
	document.write("Copyright \(C\) <A href='mailto:chaparral1965@yahoo.co.jp '>Yasuhiro Osada </A>Since 2000 All Rights Reserved");
	document.write("</FONT></center>");
	document.write("</address>");
}

