//////////////////////////////////////////////////////////////

//	------------------------------------
//	[ e-toner.net ]
//	------------------------------------
//	2004 (C) DKN Project
//	info@dknproject.jp

//////////////////////////////////////////////////////////////



//////////////////////////////////////////////////////////////
// [ Confirmation ]
//////////////////////////////////////////////////////////////

		function delCheck(url) {
			flag = confirm("この操作は取り消しできません。\r\n削除してもよろしいですか？");
			if (flag) { window.location.href = url; }
		}

//////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////
// [ Cart ]
//////////////////////////////////////////////////////////////

		function putPoint(tl,md,ut) {
			var fm = document.entryForm;
			if (md == "+") {
				newPoint = Number(fm.UsePoint.value) + Number(ut);
				if (newPoint > tl) { newPoint = tl; }
			}
			else {
				newPoint = Number(fm.UsePoint.value) - Number(ut);
				if (newPoint < 0) { newPoint = 0; }
			}
			fm.UsePoint.value = newPoint;
			document.getElementById("last").childNodes[0].data = tl - newPoint;
		}

		function etonaPoint(tl) {
			var fm = document.entryForm;
			if (fm.UsePoint.value != "") {
				stringCov(fm.UsePoint.value);
				newPoint = Number(newStr);
				if (newPoint < 0) { newPoint = 0; }
				if (newPoint > tl) { newPoint = tl; }
				fm.UsePoint.value = newPoint;
				document.getElementById("last").childNodes[0].data = tl - newPoint;
			}
			else {
				fm.UsePoint.value = 0;
				document.getElementById("last").childNodes[0].data = tl;
			}
		}

		function giftCode() {
			var fm = document.entryForm;
			if (fm.Giftcode.value != "") { stringCov(fm.Giftcode.value); fm.Giftcode.value = newStr; }
		}

		function boxValue() {
			var fm = document.entryForm;
			if (fm.genbutsu.value != 0) {
				if (fm.bar.value != "") { stringCov(fm.bar.value); fm.bar.value = newStr; }
				fm.box.value = Math.round((fm.bar.value / 3) + 0.3);
			}
		}

		function cartStep2ck() {
			fm = document.entryForm;
			if (fm.genbutsu.value != 0) {
				if (fm.CollectDate.selectedIndex == 0) { alert("回収希望日を選択してください。"); fm.CollectDate.focus(); return false; }
				if (fm.bar.value == "") { alert("回収トナー本数を入力してください。"); fm.bar.focus(); return false; }
				if (fm.box.value == "") { alert("回収梱包数を入力してください。"); fm.box.focus(); return false; }
			}
			if (fm.sokuno.value != 0) {
				if (!fm.Kaisyu[0].checked && !fm.Kaisyu[1].checked) { alert("回収方法を選択してください。"); fm.Kaisyu[0].focus(); return false; }
			}
			//if (fm.deli.value == 1) {
			//	if (fm.deliver.selectedIndex == 0) { alert("お届け日を選択してください。"); fm.deliver.focus(); return false; }
			//}
			fm.submit();
		}

		function cartStep3ck() {
			fm = document.entryForm;

			if (fm.ck1.value == 0 && fm.ck2.value == 0) {
				//  上記住所へ送る
				if (!fm.Deliver.checked) { alert("お届け先を選択してください。"); fm.Deliver.focus(); return false; }
			}
			else if (fm.ck1.value != 0 && fm.ck2.value == 0) {
				//  上記住所へ送る　＆　お届け先から選ぶ
				if (!fm.Deliver[0].checked && !fm.Deliver[1].checked) { alert("お届け先を選択してください。"); fm.Deliver[0].focus(); return false; }
				if (fm.Deliver[1].checked && fm.DeliAddress.selectedIndex == 0) { alert("お届け先を選択してください。"); fm.DeliAddress.focus(); return false; }
			}
			else if (fm.ck1.value == 0 && fm.ck2.value != 0) {
				//  上記住所へ送る　＆　社内ユーザーから選ぶ
				if (!fm.Deliver[0].checked && !fm.Deliver[1].checked) { alert("お届け先を選択してください。"); fm.Deliver[0].focus(); return false; }
				if (fm.Deliver[1].checked && fm.ChildUsers.selectedIndex == 0) { alert("お届け先を選択してください。"); fm.ChildUsers.focus(); return false; }
			}
			else {
				if (!fm.Deliver[0].checked && !fm.Deliver[1].checked && !fm.Deliver[2].checked) { alert("お届け先を選択してください。"); fm.Deliver[0].focus(); return false; }
				if (fm.Deliver[1].checked && fm.DeliAddress.selectedIndex == 0) { alert("お届け先を選択してください。"); fm.DeliAddress.focus(); return false; }
				if (fm.Deliver[2].checked && fm.ChildUsers.selectedIndex == 0) { alert("お届け先を選択してください。"); fm.ChildUsers.focus(); return false; }
			}
			fm.submit();
		}



		function radioDeliver0() {
//====================
//コード変更（okade[PF] MOD 2006/09/14）
//			fm = document.entryForm;
//			if (fm.ck1.value != 0 && fm.ck2.value != 0) {
//				fm.DeliAddress.selectedIndex = 0;
//				fm.ChildUsers.selectedIndex = 0;
//			}
//			else if (fm.ck1.value != 0 && fm.ck2.value == 0) {
//				fm.DeliAddress.selectedIndex = 0;
//			}
//			else if (fm.ck1.value == 0 && fm.ck2.value != 0) {
//				fm.ChildUsers.selectedIndex = 0;
//			}
//--------------------
			fm = document.entryForm;
			if (fm.ck1.value != 0) {
				fm.DeliAddress.selectedIndex = 0;
			}
			if (fm.ck2.value != 0) {
				fm.ChildUsers.selectedIndex = 0;
			}
//====================//
		}

		function radioDeliver1() {
			fm = document.entryForm;
			if (fm.ck2.value != 0) { fm.ChildUsers.selectedIndex = 0; }

		}

		function radioDeliver2() {
			fm = document.entryForm;
			if (fm.ck1.value != 0) { fm.DeliAddress.selectedIndex = 0; }

		}



		function selectDeliver1() {
			fm = document.entryForm;
			fm.Deliver[1].checked = true;
			if (fm.ck2.value != 0) { fm.ChildUsers.selectedIndex = 0; }

		}


		function selectDeliver2() {
			fm = document.entryForm;
			if (fm.ck1.value != 0) {
				fm.Deliver[2].checked = true;
				fm.DeliAddress.selectedIndex = 0;
			}
			else{
				fm.Deliver[1].checked = true;
			}
		}



//====================
// コード追加(kawashima[PF] ADD 2006/09/14)

		function radio_Gathering_Deliver0() {
			fm = document.entryForm;
			if (fm.ck1.value != 0) {
				fm.Gathering_DeliAddress.selectedIndex = 0;
			}
			if (fm.ck2.value != 0) {
				fm.Gathering_ChildUsers.selectedIndex = 0;
			}
		}

		function radio_Gathering_Deliver1() {
			fm = document.entryForm;
			if (fm.ck2.value != 0) { fm.Gathering_ChildUsers.selectedIndex = 0; }

		}

		function radio_Gathering_Deliver2() {
			fm = document.entryForm;
			if (fm.ck1.value != 0) { fm.Gathering_DeliAddress.selectedIndex = 0; }

		}

		function select_Gathering_Deliver1() {
			fm = document.entryForm;
			fm.Gathering_Deliver[1].checked = true;
			if (fm.ck2.value != 0) { fm.Gathering_ChildUsers.selectedIndex = 0; }

		}

		function select_Gathering_Deliver2() {
			fm = document.entryForm;
			if (fm.ck1.value != 0) {
				fm.Gathering_Deliver[2].checked = true;
				fm.Gathering_DeliAddress.selectedIndex = 0;
			}
			else{
				fm.Gathering_Deliver[1].checked = true;
			}
		}



		function radio_QuickSale_Deliver0() {
			fm = document.entryForm;
			if (fm.ck1.value != 0) {
				fm.QuickSale_DeliAddress.selectedIndex = 0;
			}
			if (fm.ck2.value != 0) {
				fm.QuickSale_ChildUsers.selectedIndex = 0;
			}
		}

		function radio_QuickSale_Deliver1() {
			fm = document.entryForm;
			if (fm.ck2.value != 0) { fm.QuickSale_ChildUsers.selectedIndex = 0; }

		}

		function radio_QuickSale_Deliver2() {
			fm = document.entryForm;
			if (fm.ck1.value != 0) { fm.QuickSale_DeliAddress.selectedIndex = 0; }

		}



		function select_QuickSale_Deliver1() {
			fm = document.entryForm;
			fm.QuickSale_Deliver[1].checked = true;
			if (fm.ck2.value != 0) { fm.QuickSale_ChildUsers.selectedIndex = 0; }

		}


		function select_QuickSale_Deliver2() {
			fm = document.entryForm;
			if (fm.ck1.value != 0) {
				fm.QuickSale_Deliver[2].checked = true;
				fm.QuickSale_DeliAddress.selectedIndex = 0;
			}
			else{
				fm.QuickSale_Deliver[1].checked = true;
			}

		}
//====================//



//////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////
// [ Login ]
//////////////////////////////////////////////////////////////

		function autoCheck() {
			fm = document.entryForm;
			fm.user[1].checked = true;
		}

		function newLogin() {
			fm = document.entryForm;
			if (fm.user[1].checked) {
				if (fm.CustomerNo.value == "") { alert("エトナIDを入力してください。"); fm.CustomerNo.focus(); return false; }
				if (fm.Password.value == "") { alert("パスワードを入力してください。"); fm.Password.focus(); return false; }
				fm.submit();
			}
//
// 2005/6/17 by ProgFast
//			else { window.location.href = "../user/index.html"; }
//
			else { fm.submit(); }

		}

//////////////////////////////////////////////////////////////
