///////////////////////////////////////////
///	『 JAVASCRIPTライブラリ 』	///
///		第一電子株式会社	///
///	Copyright (C) 2005		///
///	DaiichiDenshi Corporation.	///
///	All Rights Reserved.		///
///////////////////////////////////////////

//////////////////
// フレーム解除 //
//////////////////
//if (self != top){ top.location.href = self.location.href; }
//if(this.name == ''){ location.href('index.html'); }

///////////////////////////////////
// Win/Macフォント統一スクリプト //
///////////////////////////////////
//document.write('<style type="text/css"><!--');
//if(navigator.platform=="MacPPC"){ document.write('.text { font-size:80%}') }
//else{ document.write('.text { font-size:90%}') }
//document .write('--></style>');

//////////////
// 月日取得 //
//////////////
atDate = new Date();
atMonth = atDate.getMonth()+1;
atDate = atDate.getDate();

//////////////////////////////////////////////////////
//キー name に対する値 value をクッキーに保存します｡
//////////////////////////////////////////////////////
// SetCookie(キー名,値,有効期限,パス,ドメイン,セキュリティー?)
//////////////////////////////////////////////////////////
function SetCookie(name,value,expires,path,domain,secure)
{
  var wr_text = "";
  if(value)
    wr_text = name + "=" + escape(value);
  else
    wr_text = name + "=" + escape(" ");

  if(expires)
    wr_text += ("; expires=" + expires.toGMTString());
  if(path)
    wr_text += ("; path=" + path);
  if(domain)
    wr_text += ("; domain" + domain);
  if(secure)
    wr_text += secure;
  document.cookie = wr_text;
}

/////////////////////////////////////////////////////////
// クッキーを読み込んで､キーに対応する値を返す｡
////////////////////////////////////////////////////////
// GetCookie(キー名)
///////////////////////////////////////////////////////
function GetCookie(name)
{
  var index;
  var start;
  var end;
  var i=1;

  if(document.cookie){
    index = document.cookie.indexOf(name,0);
    if(index != -1){
      start = document.cookie.indexOf("=",index) + 1;
      end = document.cookie.indexOf(";",index);
      if(end == -1)
        end = document.cookie.length;
      if(unescape(document.cookie.substring(start,end))==" ")
        return("");

      return(unescape(document.cookie.substring(start,end)));
    }else{
      return("");
    }
  }
  return(null);
}

//////////////////////
//イメージプレロード//
//////////////////////
//data = new Array("img1.jpg","img2.jpg","img3.jpg","img4.jpg");
//prImg= new Array();
//for (i=0; i<data.length; i++)
//{
//	prImg[i] = new Image();
//	prImg[i].src = data[i];
//}

////////////////////////
// ブラウザーチェック //
////////////////////////
function navType(){
	if( navigator.appName == 'Microsoft Internet Explorer' ){
		if( navigator.appVersion == '4.0'){}
	}
	if( navigator.appName == 'Netscape' ){
		if( navigator.appVersion == '4.78'){}
		if( navigator.appVersion == '5.0'){}
	}
}

///////////////////////
// 直前のURLチェック //
///////////////////////
function checkURL(){
	nxtURL = 'http://www./';		//ジャンプ先のURL指定
	myURL = document.URL;			//現在のURL取得
	myHOST = location.hostname;		//ホスト名の取得
	oldURL = document.referrer;		//ジャンプ元のURL取得
	oldHOST = oldURL.substring(7,19);	//substring(http://の文字数,ドメインまでの文字数)
	if(oldHOST != myHOST || oldHOST == 0){location.href(nxtURL);}
}

//////////////////////
// ファイル名の取得 //
//////////////////////
function GetFileName(file_url){
	file_url = file_url.substring(file_url.lastIndexOf("/")+1,file_url.length)
	//拡張子も取り除く場合は次の行のコメントアウトをはずしてください
	//file_url = file_url.substring(0,file_url.indexOf("."));
	return file_url;
MyFile = GetFileName(location.href);
}

////////////////////////////
// ポップアップウインドウ //
////////////////////////////
//【HTML記述例】popWin('表示させるアドレス',ウィンドウの幅,ウインドウの高さ,スクロールバーON/OFF);
function popWin(url,w,h,s){
	window.open(url, 'win','width='+ w +',height='+ h +',scrollbars=' + s + ',status=0,directories=0,menubar=0,resizable=1,toolbar=0,fullscreen=0,dependent=1');
}

///////////////////////
// ウインドウリサイズ//
///////////////////////
function winResize(){
	if (navigator.appName == "Netscape"){
		moveTo(7, 7);
		resizeTo(715, 365);
	}
	else{
		if (navigator.appName == "Microsoft Internet Explorer"){
			moveTo(14, 50);
			resizeTo(747, 524);
		}
		else{
			alert("The window autoresize feature is not supported by your browser.  Please resize the window manually.");
		}
	}
}

