
  var ErrMsg1  = "Enter all necessary items";
  var ErrMsg2  = "The specified number connot be found";
  var ErrMsg3  = "The specified customer account No. cannot be found";
  var ErrMsg4  = "Wrong password";
  var ErrMsg5  = "Please correct the date";
  var ErrMsg6  = "Please enter only one";
  var ErrMsg7  = "No data matching your request was found";
  var ErrMsg8  = "Please specify period of within 1 month from the 'date from'";
  var ErrMsg9  = "No data found corresponding to number specified";
  var ErrMsg10 = "For use only by registered customers";
  var ErrMsg11 = "That customer account number is invalid";
  var ErrMsg12 = "Enter here";
  var ErrMsg13 = "Please confirm that number is correct";
  var ErrMsg14 = "That ORIGIN or DESTIONATION is invalid";

// ２−１画面時の入力チェック
function EnterCheck() {
  strDateTo=document.F1.DateTo.value
  while (strDateTo.indexOf(" ")==0) {
    strDateTo = strDateTo.replace(" ","");
  }
  strDateToLength=strDateTo.length
  while (strDateTo.charAt(strDateToLength-1)==" ") {
    strDateToLength=strDateToLength-1
  }
  strDateTo=strDateTo.slice(0,strDateToLength)
  strDateFrom=document.F1.DateFrom.value
  while (strDateFrom.indexOf(" ")==0) {
    strDateFrom = strDateFrom.replace(" ","");
  }
  strDateFromLength=strDateFrom.length
  while (strDateFrom.charAt(strDateFromLength-1)==" ") {
    strDateFromLength=strDateFromLength-1
  }
  strDateFrom=strDateFrom.slice(0,strDateFromLength)
  // 2001/4/17 tajima upd
  //if ((document.F1.InvoiceNo.value == "" || document.F1.InvoiceNo.value.match("^[\\s]+$") != null) && ((strDateFrom == "") || ((document.F1.DataOrigin.value == "" || document.F1.DataOrigin.value.match("^[\\s]+$") != null) && (document.F1.DataDestination.value == "" || document.F1.DataDestination.value.match("^[\\s]+$") != null)))) {
  if ((document.F1.InvoiceNo.value == "" || document.F1.InvoiceNo.value.match("^[\\s]+$") != null) && (strDateFrom == "")) {
    alert(ErrMsg1);
    document.F1.InvoiceNo.focus();
    return(false);
  }
  
//  else if ((document.F1.InvoiceNo.value != "" && document.F1.InvoiceNo.value.match("^[\\s]+$") == null) && ((strDateFrom != "") || (strDateTo != "") || (document.F1.DataOrigin.value != "" && document.F1.DataOrigin.value.match("^[\\s]+$") == null) || (document.F1.DataDestination.value != "" && document.F1.DataDestination.value.match("^[\\s]+$") == null))) { 
//    alert("Please select (INVOICE NO, P/O NO, etc.) or (DATE and CODE)."); document.F1.InvoiceNo.focus(); return(false); 
//  } 
  
  
   else if ((document.F1.InvoiceNo.value == "" || document.F1.InvoiceNo.value.match("^[\\s]+$") != null) && ((document.F1.DateTo.value != "" && document.F1.DateTo.value.match("^[\\s]+$") == null && (isNaN(strDateTo) == true || strDateTo.length != 8)) || isNaN(strDateFrom) == true || strDateFrom.length != 8)) {
    alert(ErrMsg5);
    document.F1.InvoiceNo.focus();
    return(false);
  }
  
   else if ((document.F1.InvoiceNo.value == "" || document.F1.InvoiceNo.value.match("^[\\s]+$") != null) && (document.F1.DateTo.value != "" && document.F1.DateTo.value.match("^[\\s]+$") == null) && (((parseInt(strDateTo) - parseInt(strDateFrom) > 100) && (parseInt(strDateTo) - parseInt(strDateFrom) < 8870)) || (parseInt(strDateTo) - parseInt(strDateFrom) > 8900) || (parseInt(strDateTo) - parseInt(strDateFrom) < 0))) {
    alert(ErrMsg8);
    document.F1.InvoiceNo.focus();
    return(false);
  }
   else if ((document.F1.InvoiceNo.value == "" || document.F1.InvoiceNo.value.match("^[\\s]+$") != null) && (document.F1.DataOrigin.value.match(/[^abcdefghijklmnopqrstuvwxyz]/i) != null || document.F1.DataDestination.value.match(/[^abcdefghijklmnopqrstuvwxyz]/i) != null)) {
    alert(ErrMsg14);
    document.F1.InvoiceNo.focus();
    return(false);
  }
  
//日付チェック  kenw 2000/12/14  追加
  if ((document.F1.InvoiceNo.value == "" || document.F1.InvoiceNo.value.match("^[\\s]+$") != null) && (((document.F1.DateTo.value != "" && document.F1.DateTo.value.match("^[\\s]+$") == null) && (Datecheck(strDateTo) != "0")) || ((document.F1.DateFrom.value != "" && document.F1.DateFrom.value.match("^[\\s]+$") == null) && (Datecheck(strDateFrom) != "0")))) {
    alert(ErrMsg8);
    document.F1.InvoiceNo.focus();
    return(false);
  }
    
  
  
  
  
  return(true);
}

// ２−１画面時の入力チェック(INVOICE#入力フォーム無)
function EnterCheck_NoINVOICE() {
  strDateTo=document.F1.DateTo.value
  while (strDateTo.indexOf(" ")==0) {
    strDateTo = strDateTo.replace(" ","");
  }
  strDateToLength=strDateTo.length
  while (strDateTo.charAt(strDateToLength-1)==" ") {
    strDateToLength=strDateToLength-1
  }
  strDateTo=strDateTo.slice(0,strDateToLength)
  strDateFrom=document.F1.DateFrom.value
  while (strDateFrom.indexOf(" ")==0) {
    strDateFrom = strDateFrom.replace(" ","");
  }
  strDateFromLength=strDateFrom.length
  while (strDateFrom.charAt(strDateFromLength-1)==" ") {
    strDateFromLength=strDateFromLength-1
  }
  strDateFrom=strDateFrom.slice(0,strDateFromLength)
  // 2001/4/17 tajima upd
  //if (((strDateFrom == "") || ((document.F1.DataOrigin.value == "" || document.F1.DataOrigin.value.match("^[\\s]+$") != null) && (document.F1.DataDestination.value == "" || document.F1.DataDestination.value.match("^[\\s]+$") != null)))) {
  if (strDateFrom == ""){
    alert(ErrMsg1);
    return(false);
  }

   else if (((document.F1.DateTo.value != "" && document.F1.DateTo.value.match("^[\\s]+$") == null && (isNaN(strDateTo) == true || strDateTo.length != 8)) || isNaN(strDateFrom) == true || strDateFrom.length != 8)) {
    alert(ErrMsg5);
    return(false);
  }
  
   else if ((document.F1.DateTo.value != "" && document.F1.DateTo.value.match("^[\\s]+$") == null) && (((parseInt(strDateTo) - parseInt(strDateFrom) > 100) && (parseInt(strDateTo) - parseInt(strDateFrom) < 8870)) || (parseInt(strDateTo) - parseInt(strDateFrom) > 8900) || (parseInt(strDateTo) - parseInt(strDateFrom) < 0))) {
    alert(ErrMsg8);
    return(false);
  }
   else if ((document.F1.DataOrigin.value.match(/[^abcdefghijklmnopqrstuvwxyz]/i) != null || document.F1.DataDestination.value.match(/[^abcdefghijklmnopqrstuvwxyz]/i) != null)) {
    alert(ErrMsg14);
    return(false);
  }
  
//日付チェック  kenw 2000/12/14  追加
  if ((((document.F1.DateTo.value != "" && document.F1.DateTo.value.match("^[\\s]+$") == null) && (Datecheck(strDateTo) != "0")) || ((document.F1.DateFrom.value != "" && document.F1.DateFrom.value.match("^[\\s]+$") == null) && (Datecheck(strDateFrom) != "0")))) {
    alert(ErrMsg8);
    return(false);
  }


  return(true);
}


// ２−１画面時のMODE OF TRANSPORT選択チェック
// 2001/3/7 tajima 現在は使用していない
function chk_mode(selectedmode,ModeAir,ModeOcean,ModeOthers)
{
  if (selectedmode=="1") {
    if (ModeAir != 1) {
      alert(ErrMsg10);
      return(false);
    }
  }
  
  if (selectedmode=="2") {
    if (ModeOcean != 1) {
      alert(ErrMsg10);
      return(false);
    }
  }
  if (selectedmode=="3") {
    if (ModeOthers != 1) {
      alert(ErrMsg10);
      return(false);
    }
  }
  return(true);
}



// OptionalSearch初期画面時の入力チェック
function AccountCheck() {
  if (document.F1.Account.value == "" || (document.F1.Account.value.match("^[\\s]+$") != null)) {
    alert(ErrMsg1);
    document.F1.Account.focus();
    return(false);
  }
  return(true);
}



// QuickSearch初期画面時の入力チェック
function select() {
  i = 0
  T1_Text=document.F1.T1.value
  while (T1_Text.indexOf(" ")==0) {
    T1_Text = T1_Text.replace(" ","");
  }
  LineLength=T1_Text.length
  while (T1_Text.charAt(LineLength-1)==" ") {
    LineLength=LineLength-1
  }
  T1_Text=T1_Text.slice(0,LineLength)
  if (T1_Text != "YAS-" && document.F1.T1.value != "YAS-") {
    if (document.F1.T1.value != "" && (document.F1.T1.value.match("^[\\s]+$") == null)){
      i = i + 1;
    }
  }
/*
  if (document.F1.T2.value != "" && (document.F1.T2.value.match("^[\\s]+$") == null)) {
    i = i + 1;
  }
  if (document.F1.T3.value != "" && (document.F1.T3.value.match("^[\\s]+$") == null)) {
    i = i + 1;
  }
*/
  //2001/3/14 tajima commentout
  //if (document.F1.T4.value != "" && (document.F1.T4.value.match("^[\\s]+$") == null)) {
  //  i = i + 1;
  //}
  if (i > 1) {
    alert(ErrMsg6);
    document.F1.T1.focus();
    return(false);
  }
  if (i == 0) {
    alert(ErrMsg1);
    document.F1.T1.focus();
    return(false);
  }
  return(true);
}




//LoginCountの入力チェック
function DataCheck() {
  if (document.F1.AccountNo.value == "" || (document.F1.AccountNo.value.match("^[\\s]+$") != null)) {
  alert(ErrMsg11);
  document.F1.AccountNo.focus();
  return(false);
  }
  if (document.F1.LoginFromDate.value == "" || (document.F1.LoginFromDate.value.match("^[\\s]+$") != null)) {
  alert(ErrMsg5);
  document.F1.AccountNo.focus();
  return(false);
  }
  if (document.F1.LoginFromDate.value.length != 8 || (isNaN(document.F1.LoginFromDate.value) == true)) {
  alert(ErrMsg5);
  document.F1.AccountNo.focus();
  return(false);
  }
  if ((document.F1.LoginToDate.value != "" && (document.F1.LoginToDate.value.match("^[\\s]+$") == null)) && (document.F1.LoginToDate.value.length != 8 || (isNaN(document.F1.LoginToDate.value) == true))) {
  alert(ErrMsg5);
  document.F1.AccountNo.focus();
  return(false);
  }
  if (Datecheck(document.F1.LoginFromDate.value) != "0") {
  alert(ErrMsg5);
  document.F1.AccountNo.focus();
  return(false);
  }
  if ((document.F1.LoginToDate.value != "" && (document.F1.LoginToDate.value.match("^[\\s]+$") == null)) && (Datecheck(document.F1.LoginToDate.value) != "0")) {
  alert(ErrMsg5);
  document.F1.AccountNo.focus();
  return(false);
  }
}






function Datecheck(date)
{
//*********************************************************
//	日付チェック:Datecheck
//	処理概要		:日付チェック関数
//					:date:文字列:チェックする値
//	戻り値			:正常 = 0, 異常 = -1
//*********************************************************
	date1 = date.substring(0,4);
	date2 = date.substring(4,6);
	date3 = date.substring(6,8);
	if(cCheckAttr(date1,date2,date3)==-1){
		return -1
	}
	return 0
}

function cCheckAttr(value1, value2, value3)
{
//*********************************************************
//	文字属性チェック:cCheckAttr
//	処理概要		:文字列チェック関数
//					:value1:文字列:チェックする値1
//					:value2:文字列:チェックする値2
//					:value3:文字列:チェックする値3
//	戻り値			:正常 = 0, 異常 = -1
//*********************************************************
	//有効日付であるかのチェック

		//年のチェック（4桁、数値、1890-2100）
		if (value1.length != 4)
		{
			return -1 ;
		}
		if (cIsDigit(value1) != 0)
		{
			return -1 ;
		}
		wYear = parseInt(value1) ;

		//月のチェック（2桁以下、数値、1-12）
		if ((value2.length > 2) || (value2.length < 1))
		{
			return -1 ;
		}
		if (cIsDigit(value2) != 0)
		{
			return -1 ;
		}
		if (value2.charAt(0) == "0")
		{
			wMonth = parseInt(value2.charAt(1)) ;
		}
		else
		{
			wMonth = parseInt(value2) ;
		}
		if (wMonth < 1 || wMonth > 12)
		{
			return -1 ;
		}

		//日のチェック（2桁以下、数値、1-31）
		if ((value3.length > 2) || (value3.length < 1))
		{
			return -1 ;
		}
		if (cIsDigit(value3) != 0)
		{
			return -1 ;
		}
		if (value3.charAt(0) == "0")
		{
			wDay = parseInt(value3.charAt(1)) ;
		}
		else
		{
			wDay = parseInt(value3) ;
		}
		if (wDay < 1 || wDay > 31)
		{
			return -1 ;
		}

//alert(wYear) ;
//alert(wMonth) ;
//alert(wDay) ;
		
		//月・日の妥当性チェック
		if (wMonth == 1 || wMonth == 3 || wMonth == 5 || wMonth == 7 || wMonth == 8 || wMonth == 10 || wMonth == 12)
		{
			return 0 ;
		}
		if (wMonth == 4 || wMonth == 6 || wMonth == 9 || wMonth == 11)
		{
			if (wDay == 31)
			{
				return -1 ;
			}
			else
			{
				return 0 ;
			}
		}
		if (wMonth == 2)
		{
			//西暦の年数が4で割り切れ、かつ100で割り切れない年をうるう年とする。 
			//西暦の年数が400で割り切れる年もうるう年とする。 
			if ((wYear % 4) == 0 && (wYear % 100) != 0)
			{
				//閏年処理
				if (wDay < 30)
				{
					return 0 ;
				}
				else
				{
					return -1 ;
				}
			}
			else
			{
				if ((wYear % 400) == 0)
				{
					//閏年処理
					if (wDay < 30)
					{
						return 0;
					}
					else
					{
						return -1;
					}
				}
				else
				{
					//通常年処理
					if (wDay < 29)
					{
						return 0 ;
					}
					else
					{
						return -1 ;
					}
				}
			}
		}
}



function cIsDigit(number)
{
//*********************************************************
//	文字属性チェック:Charcheck
//	処理概要		   :半角数字
//	引数		   	   :number  :文字列
//	戻り値		   :正常 = 0, 異常 = -1
//*********************************************************
	NStr = "0123456789" ;

	for (i1 = 0; i1 < number.length; i1++)
	{
		found = 0 ;
		ch = number.charAt(i1) ;
		for (j1 = 0; j1 < NStr.length; j1++)
		{
			Nch = NStr.charAt(j1) ;
			if (ch == Nch)
			{
				found = 1 ;
				continue ;
			}
		}
		if (found != 1)
		{
			return -1 ;
		}
	}
	return 0 ;
}



function AwbImageCheck() {
  if (document.F1.HawbNum.value == "" || (document.F1.HawbNum.value.match("^[\\s]+$") != null)) {
  alert(ErrMsg1);
  document.F1.HawbNum.focus();
  return(false);
  }
}

//*********************************************************
//	日付チェック:PRINTDataSend
//	処理概要		:HAWB_PRINT.aspでPDF出力する際に必要なデータをPOSTする
//	引数		   	:なし
//	戻り値			:なし
//*********************************************************
function PRINTDataSend() {
  document.frmPRINT.submit();
  return(false);
}

//*********************************************************
//	日付チェック:CSVDataSend
//	処理概要		:DOWNLOAD.csvでCSV出力する際に必要なデータをPOSTする
//	引数		   	:なし
//	戻り値			:なし
//*********************************************************
function CSVDataSend() {
  document.frmCSV.submit();
  return(false);
}


//*********************************************************
//	関数名             : NewOriginWin()
//	処理概要	   : PLACE(ORIGIN)ボタンクリック時に、別ウィンドウを表示する
//	引数		   : なし
//	戻り値		   : なし
//*********************************************************
function NewOriginWin() {
     szUrl = "newwindow.asp" ;
     szUrl = szUrl + "?searchPRM=" + document.F1.DataOrigin.value + "&ModeOfTransport=" + document.F1.ModeOfTransport.options[document.F1.ModeOfTransport.selectedIndex].value + "&DataType=DataOrigin";
     window.open(szUrl,"OriginWin","width=500,height=300,resizable=yes,scrollbars=yes");
}

//*********************************************************
//	関数名             : NewDestinationWin()
//	処理概要	   : PLACE(DESTINATION)ボタンクリック時に、別ウィンドウを表示する
//	引数		   : なし
//	戻り値		   : なし
//*********************************************************
function NewDestinationWin() {
     szUrl = "newwindow.asp" ;
     szUrl = szUrl + "?searchPRM=" + document.F1.DataDestination.value + "&ModeOfTransport=" + document.F1.ModeOfTransport.options[document.F1.ModeOfTransport.selectedIndex].value + "&DataType=DataDestination";
     window.open(szUrl,"DestinationWin","width=500,height=300,resizable=yes,scrollbars=yes");
}

//*********************************************************
//	関数名             : ChangeTopFrame()
//	処理概要	   : OKボタンクリック時に、TOPフレームを変更する
//	引数		   : strHTML	変更後のHTML
//	戻り値		   : なし
//*********************************************************
function ChangeTopFrame(strHTML) {
	parent.top.location.href = strHTML;
}

//*********************************************************
//	関数名             : ChangeMenuFrame()
//	処理概要	   : OKボタンクリック時に、FRAME_MENUフレームを変更する
//	引数		   : strHTML	変更後のHTML
//	戻り値		   : なし
//*********************************************************
function ChangeMenuFrame(strHTML) {
	parent.FRAME_MENU.location.href = strHTML;
}

//*********************************************************
//	関数名             : ChangeFormFrame()
//	処理概要	   : OKボタンクリック時に、FRAME_FORMフレームを変更する
//	引数		   : strHTML	変更後のHTML
//	戻り値		   : なし
//*********************************************************
function ChangeFormFrame(strHTML) {
	parent.FRAME_FORM.location.href = strHTML;
}

//*********************************************************
//	関数名             : TRACKINGtoPRINT
//	処理概要	   : TRACKING画面からAWB PRINT画面に遷移する際に必要なデータをPOSTする
//	引数		   : なし
//	戻り値		   : なし
//*********************************************************
function TRACKINGtoPRINT() {
	document.frmPRINT.submit();
        return(false);
}

//*********************************************************
//	関数名             : TRACKINGtoREPORT
//	処理概要	   : TRACKING画面からREPORT画面に遷移する際に必要なデータをPOSTする
//	引数		   : なし
//	戻り値		   : なし
//*********************************************************
function TRACKINGtoREPORT() {
	document.frmREPORT.submit();
        return(false);
}

//*********************************************************
//	関数名             : ChangeActionTOP
//	処理概要	   : STATUS LIST画面でFormのAction属性(top)を変更する
//	引数		   : str
//	戻り値		   : なし
//*********************************************************
function ChangeActionTOP(str) {
	document.STATUS_LIST.action=str;
	document.STATUS_LIST.target='_top'
}

//*********************************************************
//	関数名             : ChangeAction
//	処理概要	   : SHIPMENT LIST,IRREGULAR LIST画面でFormのAction属性を変更する
//	引数		   : str
//	戻り値		   : なし
//*********************************************************
function ChangeAction(str) {
	document.F1.action=str;
}

//↓20060928 追加↓C-007-05
//*********************************************************
//	関数名             : TextSubmitJapanese
//	処理概要	   : Japaneseアンカーリンクをクリックした場合のSubmit処理を行う
//	引数		   : なし
//	戻り値		   : なし
//*********************************************************
function TextSubmitJ(){
    document.Japanese.submit();
}

//*********************************************************
//	関数名             : TextSubmitEnglish
//	処理概要	   : Englishアンカーリンクをクリックした場合のSubmit処理を行う
//	引数		   : なし
//	戻り値		   : なし
//*********************************************************
function TextSubmitE(){
    document.English.submit();
}

//↑20060928 追加↑C-007-05

//↓20061004 追加↓C-007-04
//*********************************************************
//	関数名             : TextSubmitEnglish
//	処理概要	   : 再検索部品使用時の入力値チェック処理を行う
//	引数		   : なし
//	戻り値		   : なし
//*********************************************************

// QuickSearch初期画面時の入力チェック
function N_SearchCheck() {

  b_true = new Boolean(true)
  
  i = 0
  document.N_Search.T1.value=""
//  document.N_Search.T2.value=""
//  document.N_Search.T3.value=""


  if (document.N_Search.Function(0).checked == b_true) {
    document.N_Search.T1.value=document.N_Search.Text1.value;	
  }
/*
  if (document.N_Search.Function(1).checked == b_true) {
    document.N_Search.T2.value=document.N_Search.Text1.value;	
  }
  if (document.N_Search.Function(2).checked == b_true) {
    document.N_Search.T3.value=document.N_Search.Text1.value;	
  }
*/
  T1_Text=document.N_Search.T1.value
  while (T1_Text.indexOf(" ")==0) {
    T1_Text = T1_Text.replace(" ","");
  }
  LineLength=T1_Text.length
  while (T1_Text.charAt(LineLength-1)==" ") {
    LineLength=LineLength-1
  }
  T1_Text=T1_Text.slice(0,LineLength)
//  if (T1_Text != "YAS-" && document.N_Search.T1.value != "YAS-") {
  if (document.N_Search.T1.value != "YAS-" && document.N_Search.T1.value != "") {
    if (document.N_Search.T1.value != "" && (document.N_Search.T1.value.match("^[\\s]+$") == null)){
      i = i + 1;
    }
  }
/*
  if (document.N_Search.T2.value != "YAS-" && document.N_Search.T2.value != "") {
    if (document.N_Search.T2.value != "" && (document.N_Search.T2.value.match("^[\\s]+$") == null)) {
      i = i + 1;
    }
  }
  if (document.N_Search.T3.value != "YAS-" && document.N_Search.T3.value != "") {
    if (document.N_Search.T3.value != "" && (document.N_Search.T3.value.match("^[\\s]+$") == null)) {
      i = i + 1;
    }
  }
*/
  if (i > 1) {
    alert(ErrMsg6);
    document.N_Search.Text1.focus();
    return(false);
  }
  if (i == 0) {
    alert(ErrMsg1);
    document.N_Search.Text1.focus();
    return(false);
  }
  return(true);
}

//↑20061004 追加↑C-007-04

//↓20061101 追加↓C2-016-01
// QuickSearch初期画面時の入力チェック
function select2() {
  i = 0
  T1_Text=document.N_Search.T1.value
  while (T1_Text.indexOf(" ")==0) {
    T1_Text = T1_Text.replace(" ","");
  }
  LineLength=T1_Text.length
  while (T1_Text.charAt(LineLength-1)==" ") {
    LineLength=LineLength-1
  }
  T1_Text=T1_Text.slice(0,LineLength)
  if (T1_Text != "YAS-" && document.N_Search.T1.value != "YAS-") {
    if (document.N_Search.T1.value != "" && (document.N_Search.T1.value.match("^[\\s]+$") == null)){
      i = i + 1;
    }
  }
/*
  if (document.N_Search.T2.value != "" && (document.N_Search.T2.value.match("^[\\s]+$") == null)) {
    i = i + 1;
  }
  if (document.N_Search.T3.value != "" && (document.N_Search.T3.value.match("^[\\s]+$") == null)) {
    i = i + 1;
  }
*/
  //2001/3/14 tajima commentout
  //if (document.N_Search.T4.value != "" && (document.N_Search.T4.value.match("^[\\s]+$") == null)) {
  //  i = i + 1;
  //}
  if (i > 1) {
    alert(ErrMsg6);
    document.N_Search.T1.focus();
    return(false);
  }
  if (i == 0) {
    alert(ErrMsg1);
    document.N_Search.T1.focus();
    return(false);
  }
  return(true);
}
//↑20061101 追加↑C2-016-01
