﻿
// =============================================================================
//   最大文字数入力で次の項目へ移動  
// =============================================================================
function MaxLenToNextFocus(oFmCtrl, oToCtrl) {
	var nPos = -1;

	if (oFmCtrl.selectionStart != null) {
		nPos = oFmCtrl.selectionStart;
	} else {
		var oDocRange = document.selection.createRange();
		var oTxtRange = oFmCtrl.createTextRange();
		oTxtRange.setEndPoint('EndToStart', oDocRange);
		nPos = oTxtRange.text.length;
	}

	if (oFmCtrl.maxLength <= nPos) {
		oToCtrl.focus();
		oToCtrl.select();
	}
}

// =============================================================================
//   実行チェック
// =============================================================================
function ChkExec() {
	var oDoc = window.document;
	// 実行状態を判定
	if (oDoc.readyState != null && oDoc.readyState != 'complete') {
		alert("処理中です。\nしばらくお待ちください。");
		return false;	// 処理中の為、実行不可
	} else {
		return true;	// 実行可能
	}
}

// =============================================================================
//   カタログ無料プレゼント
// =============================================================================
function catalogUrl() {

  var kaisha = "1";
  
  if (location.search.length > 1) {
    var qsstr = location.search.substr(1).split("&");
    var queries = new Array();
    var wStr = "";
    for (qcnt in qsstr) {
      wStr = qsstr[qcnt].split("=");
      if (wStr[0] == "cn") {
        kaisha = wStr[1];
      }
    }
  }

  var urlstr = "http://www.shichida.co.jp/kyoiku/catalog.php";
  if (kaisha == "1") {
    urlstr = "http://www.shichida.co.jp/kyoiku/catalog.php";
  }
  if (kaisha == "2") {
    urlstr = "http://www.shichida.co.jp/life/catalog.php";
  }
  if (kaisha == "3") {
    urlstr = "http://www.shichida.co.jp/office/catalog.php";
  }
  windows1 = window.open(urlstr,"");
}

// =============================================================================
//   会社案内
// =============================================================================
function companyUrl() {

  var kaisha = "1";
  
  if (location.search.length > 1) {
    var qsstr = location.search.substr(1).split("&");
    var queries = new Array();
    var wStr = "";
    for (qcnt in qsstr) {
      wStr = qsstr[qcnt].split("=");
      if (wStr[0] == "cn") {
        kaisha = wStr[1];
      }
    }
  }

  var urlstr = "http://www.shichida.co.jp/kyoiku/outline.php";
  if (kaisha == "1") {
    urlstr = "http://www.shichida.co.jp/kyoiku/outline.php";
  }
  if (kaisha == "2") {
    urlstr = "http://www.shichida.co.jp/life/outline.php";
  }
  if (kaisha == "3") {
    urlstr = "http://www.shichida.co.jp/office/outline.php";
  }
  windows1 = window.open(urlstr,"");
}

