//--押されたキ−コードを返す.
function getKEYCODE(e){  
	if(document.all)           return  event.keyCode
	else if(document.getElementById) 
		return (e.keyCode!=0)?e.keyCode:e.charCode
	else if(document.layers)   return  e.which
}

/*  --------------------------------------------------------------------------------------------------------  */
//ボタンの二度押し対応.

// window の Load イベントを取得.

window.onload = window_Load;

function window_Load() {
  var i;
  
  // 全ボタンのクリックイベントを取得.
	var objInput
	
	// ボタン配列を取得.
	objInput = document.getElementsByTagName("input")
	// ボタンに対して判定を行う.
	for (i = 0; i < objInput.length; i ++) {
		if (objInput[i].type == "button" ||
		objInput[i].type == "submit" ||
		objInput[i].type == "image" ||
		objInput[i].type == "reset") {
		    // ボタンのタイプが"button"、"submit"、"image"、"reset"の場合、onclickイベントを追加.
			objInput[i].onclick = ButtonObject_Click;
		}
	}

	return true;
}

function ButtonObject_Click() {
  // ボタン押下時の処理を行う.
  if (isDocumentLoading()) {
		// ページがロード中（＝ボタン押下時の動作がされている途中）の場合、.
		// ボタン多重押下を不可にする。.
    	return false;
  }
  
  return true;
}

function isDocumentLoading() {
  // このルーチンはInternetExplorer以外では常にFalseになります。.
  // （IE以外ではdocument.readyStateの値がvoidとなり、何があっても変更されないため）.
  return (document.readyState != null &&
     	  document.readyState != "complete");
}
 
/*  --------------------------------------------------------------------------------------------------------  */
