﻿function MM_openBrWindow(theURL, winName, features) {
  window.open(theURL, winName, features);
}

function jsMileOpenWindow(){
	NewWin = window.open("/th/OwnerLogs/Top/owlg0130.asp", "analysewindow", "toolbar=no, location=no, directoryies=no, status=no, menubar=no, resizable=no, scrollbars=no,width=550,height=315");
    NewWin.focus();
}

function ToAppointment(dlrcd, strcd) {
	document.Appform.BtnAppoint.disabled = true;
	document.Appform.dealerCode.value = dlrcd;
	document.Appform.branchCode.value = strcd;
	document.Appform.nextPageUrl.value = "0";
	document.Appform.submit();
}

function updateAvgMile() {
	if(document.form2.avgMile.value.length == 0) {
		document.form2.avgMile.focus();
		alert("Average Kilometres per day not entered yet.");
		return false;
	} else {
		document.form2.BtnUpdate.disabled = true;
		document.form2.BtnAnalyse1.disabled = true;
		document.form2.BtnAnalyse2.disabled = true;
		MM_openBrWindow('/th/OwnerLogs/Top/owlg0140.asp', '', 'width=318,height=100');
	}
}

function updateTotalMile(objForm) {
	document.form2.HidDIYMode.value = "MileOnly";
	if(document.form2.txtMileage.value.length == 0) {
		document.form2.txtMileage.focus();
//		alert("Today's Kilometres Reading not entered yet.");	*** 2005/11/14 イメージボタンへ変更のため削除
		return false;
	} else {
//		document.form2.BtnUpdate.disabled = true;		*** 2005/11/14 オーナーログストップ画面のレイアウト変更対応
//		document.form2.BtnAnalyse1.disabled = true;		*** 2005/11/14 オーナーログストップ画面のレイアウト変更対応
//		document.form2.BtnAnalyse2.disabled = true;		*** 2005/11/14 オーナーログストップ画面のレイアウト変更対応
		document.form2.submit();
	}
}

function jsOwlg0110Analyse(objForm) {
	objForm.HidDIYMode.value = "MileFuel";
	if(objForm.txtMileage.value.length == 0) {
		objForm.txtMileage.focus();
		alert("Total Mileage not entered yet.");
		return false;
	} else {
//		objForm.Enter.disabled = true;
		if (isEnableButton()) {
			objForm.submit();
		} else {
			return false;
		}
	}
}

function jsOwlg0110ShowMail(strMailId) {
	document.frmMail.rmtmMailId.value = strMailId;
	document.frmMail.submit();
}

var txt_Camry0="Transmission Oil Change";
var txt_Camry1="Every 60,000 km or<br>Every 48 months";
var txt_Camry2="Every 75,000 km or<br>Every 60 months";
var txt_Camry3="Every 30,000 km or<br>Every 24 months";
var txt_Camry4="Every 15,000 km or<br>Every 12 months";
var txt_Camry5="Every 15,000 km or<br>Every 12 months";
var txt_Camry6="Every 90,000 km or<br>Every 72 months<br>(V/6 only)";
var img_Camry0="../Image/ic_trans.gif"

var txt_Corolla0="";
var txt_Corolla1="Every 40,000 km or<br>Every 24 months";
var txt_Corolla2="Every 80,000 km or<br>Every 48 months";
var txt_Corolla3="Every 40,000 km or<br>Every 24 months";
var txt_Corolla4="Every 10,000 km or<br>Every 6 months";
var txt_Corolla5="Every 10,000 km or<br>Every 6 months";
var txt_Corolla6="";

var txt_Echo0="";
var txt_Echo1="Every 40,000 km or<br>Every 24 months";
var txt_Echo2="Every 80,000 km or<br>Every 48 months";
var txt_Echo3="Every 40,000 km or<br>Every 24 months";
var txt_Echo4="Every 10,000 km or<br>Every 6 months";
var txt_Echo5="Every 10,000 km or<br>Every 6 months";
var txt_Echo6="";

var txt_Prado0="Diff Oil Change (F&amp;R)";
var txt_Prado1="Every 40,000 km or<br>Every 24 months";
var txt_Prado2="Every 80,000 km or<br>Every 48 months";
var txt_Prado3="Every 40,000 km or<br>Every 24 months";
var txt_Prado4="Every 10,000 km or<br>Every 6 months";
var txt_Prado5="Every 10,000 km or<br>Every 6 months";
var txt_Prado6="Every 40,000 km or<br>Every 6 months";
var img_Prado0="../Image/ic_trans.gif"

var txt_RAV40="Transmission Oil Change";
var txt_RAV41="Every 40,000 km or<br>Every 24 months";
var txt_RAV42="Every 80,000 km or<br>Every 48 months";
var txt_RAV43="Every 40,000 km or<br>Every 24 months";
var txt_RAV44="Every 10,000 km or<br>Every 6 months";
var txt_RAV45="Every 10,000 km or<br>Every 6 months";
var txt_RAV46="Every 40,000 km or<br>Every 24 months";
var img_RAV40="../Image/ic_trans.gif"

function Change_Camry() {
	document.cookie="catasel=catasel=1; expires=Thu, 31-Dec-2037 15:00:00 GMT; path=/th/OwnerLogs/Top";
    if(document.all){
		document.all("Camry").style.fontWeight='bold';
		document.all("Corolla").style.fontWeight='normal';
		document.all("Echo").style.fontWeight='normal';
		document.all("Prado").style.fontWeight='normal';
		document.all("RAV4").style.fontWeight='normal';
		document.all("IMG").height="47";
		document.all("IMG").width="47";
		document.all("IMG").setAttribute("src",img_Camry0);
		document.all("0").innerHTML=txt_Camry0;
		document.all("1").innerHTML=txt_Camry1;
		document.all("2").innerHTML=txt_Camry2;
		document.all("3").innerHTML=txt_Camry3;
		document.all("4").innerHTML=txt_Camry4;
		document.all("5").innerHTML=txt_Camry5;
		document.all("6").innerHTML=txt_Camry6;
	}
    if(document.getElementById){
		document.getElementById("Camry").style.fontWeight='bold';
		document.getElementById("Corolla").style.fontWeight='normal';
		document.getElementById("Echo").style.fontWeight='normal';
		document.getElementById("Prado").style.fontWeight='normal';
		document.getElementById("RAV4").style.fontWeight='normal';
		document.getElementById("IMG").height="47";
		document.getElementById("IMG").width="47";
		document.getElementById("IMG").setAttribute("src",img_Camry0);
		document.getElementById("0").innerHTML=txt_Camry0;
		document.getElementById("1").innerHTML=txt_Camry1;
		document.getElementById("2").innerHTML=txt_Camry2;
		document.getElementById("3").innerHTML=txt_Camry3;
		document.getElementById("4").innerHTML=txt_Camry4;
		document.getElementById("5").innerHTML=txt_Camry5;
		document.getElementById("6").innerHTML=txt_Camry6;
	}
}

function Change_Corolla() {
	document.cookie="catasel=catasel=2; expires=Thu, 31-Dec-2037 15:00:00 GMT; path=/th/OwnerLogs/Top";
    if(document.all){
		document.all("Camry").style.fontWeight='normal';
		document.all("Corolla").style.fontWeight='bold';
		document.all("Echo").style.fontWeight='normal';
		document.all("Prado").style.fontWeight='normal';
		document.all("RAV4").style.fontWeight='normal';
		document.all("IMG").height="0";
		document.all("IMG").width="0";
		document.all("0").innerHTML=txt_Corolla0;
		document.all("1").innerHTML=txt_Corolla1;
		document.all("2").innerHTML=txt_Corolla2;
		document.all("3").innerHTML=txt_Corolla3;
		document.all("4").innerHTML=txt_Corolla4;
		document.all("5").innerHTML=txt_Corolla5;
		document.all("6").innerHTML=txt_Corolla6;
	}
    if(document.getElementById){
		document.getElementById("Camry").style.fontWeight='normal';
		document.getElementById("Corolla").style.fontWeight='bold';
		document.getElementById("Echo").style.fontWeight='normal';
		document.getElementById("Prado").style.fontWeight='normal';
		document.getElementById("RAV4").style.fontWeight='normal';
		document.getElementById("IMG").height="0";
		document.getElementById("IMG").width="0";
		document.getElementById("0").innerHTML=txt_Corolla0;
		document.getElementById("1").innerHTML=txt_Corolla1;
		document.getElementById("2").innerHTML=txt_Corolla2;
		document.getElementById("3").innerHTML=txt_Corolla3;
		document.getElementById("4").innerHTML=txt_Corolla4;
		document.getElementById("5").innerHTML=txt_Corolla5;
		document.getElementById("6").innerHTML=txt_Corolla6;
	}
}

function Change_Echo() {
	document.cookie="catasel=catasel=3; expires=Thu, 31-Dec-2037 15:00:00 GMT; path=/th/OwnerLogs/Top";
    if(document.all){
		document.all("Camry").style.fontWeight='normal';
		document.all("Corolla").style.fontWeight='normal';
		document.all("Echo").style.fontWeight='bold';
		document.all("Prado").style.fontWeight='normal';
		document.all("RAV4").style.fontWeight='normal';
		document.all("IMG").height="0";
		document.all("IMG").width="0";
		document.all("0").innerHTML=txt_Corolla0;
		document.all("1").innerHTML=txt_Corolla1;
		document.all("2").innerHTML=txt_Corolla2;
		document.all("3").innerHTML=txt_Corolla3;
		document.all("4").innerHTML=txt_Corolla4;
		document.all("5").innerHTML=txt_Corolla5;
		document.all("6").innerHTML=txt_Corolla6;
	}
    if(document.getElementById){
		document.getElementById("Camry").style.fontWeight='normal';
		document.getElementById("Corolla").style.fontWeight='normal';
		document.getElementById("Echo").style.fontWeight='bold';
		document.getElementById("Prado").style.fontWeight='normal';
		document.getElementById("RAV4").style.fontWeight='normal';
		document.getElementById("IMG").height="0";
		document.getElementById("IMG").width="0";
		document.getElementById("0").innerHTML=txt_Corolla0;
		document.getElementById("1").innerHTML=txt_Corolla1;
		document.getElementById("2").innerHTML=txt_Corolla2;
		document.getElementById("3").innerHTML=txt_Corolla3;
		document.getElementById("4").innerHTML=txt_Corolla4;
		document.getElementById("5").innerHTML=txt_Corolla5;
		document.getElementById("6").innerHTML=txt_Corolla6;
	}
}

function Change_Prado() {
	document.cookie="catasel=catasel=4; expires=Thu, 31-Dec-2037 15:00:00 GMT; path=/th/OwnerLogs/Top";
    if(document.all){
		document.all("Camry").style.fontWeight='normal';
		document.all("Corolla").style.fontWeight='normal';
		document.all("Echo").style.fontWeight='normal';
		document.all("Prado").style.fontWeight='bold';
		document.all("RAV4").style.fontWeight='normal';
		document.all("IMG").height="47";
		document.all("IMG").width="47";
		document.all("IMG").setAttribute("src",img_Prado0);
		document.all("0").innerHTML=txt_Prado0;
		document.all("1").innerHTML=txt_Prado1;
		document.all("2").innerHTML=txt_Prado2;
		document.all("3").innerHTML=txt_Prado3;
		document.all("4").innerHTML=txt_Prado4;
		document.all("5").innerHTML=txt_Prado5;
		document.all("6").innerHTML=txt_Prado6;
	}
    if(document.getElementById){
		document.getElementById("Camry").style.fontWeight='normal';
		document.getElementById("Corolla").style.fontWeight='normal';
		document.getElementById("Echo").style.fontWeight='normal';
		document.getElementById("Prado").style.fontWeight='bold';
		document.getElementById("RAV4").style.fontWeight='normal';
		document.getElementById("IMG").height="47";
		document.getElementById("IMG").width="47";
		document.getElementById("IMG").setAttribute("src",img_Prado0);
		document.getElementById("0").innerHTML=txt_Prado0;
		document.getElementById("1").innerHTML=txt_Prado1;
		document.getElementById("2").innerHTML=txt_Prado2;
		document.getElementById("3").innerHTML=txt_Prado3;
		document.getElementById("4").innerHTML=txt_Prado4;
		document.getElementById("5").innerHTML=txt_Prado5;
		document.getElementById("6").innerHTML=txt_Prado6;
	}
}

function jsOwlg0110Submit2(strLang)
{
	if (document.form1.txtMileage.value == '') {
		if (strLang == 'th') {
			alert('กรุณาใส่ระยะทางการเดินทางโดยรวม');
		}else{
			alert('Total mileage is an entry required item.');
		}
		document.form1.txtMileage.focus();
		return false;
	}else{
		document.form1.action = '/th/OwnerLogs/Top/owlg0110.asp';
		document.all("Enter").disabled = true;
		document.form1.submit();
	}
	
}

function Change_RAV4() {
	document.cookie="catasel=catasel=5; expires=Thu, 31-Dec-2037 15:00:00 GMT; path=/th/OwnerLogs/Top";
    if(document.all){
		document.all("Camry").style.fontWeight='normal';
		document.all("Corolla").style.fontWeight='normal';
		document.all("Echo").style.fontWeight='normal';
		document.all("Prado").style.fontWeight='normal';
		document.all("RAV4").style.fontWeight='bold';
		document.all("IMG").height="47";
		document.all("IMG").width="47";
		document.all("IMG").setAttribute("src",img_RAV40);
		document.all("0").innerHTML=txt_RAV40;
		document.all("1").innerHTML=txt_RAV41;
		document.all("2").innerHTML=txt_RAV42;
		document.all("3").innerHTML=txt_RAV43;
		document.all("4").innerHTML=txt_RAV44;
		document.all("5").innerHTML=txt_RAV45;
		document.all("6").innerHTML=txt_RAV46;
	}
    if(document.getElementById){
		document.getElementById("Camry").style.fontWeight='normal';
		document.getElementById("Corolla").style.fontWeight='normal';
		document.getElementById("Echo").style.fontWeight='normal';
		document.getElementById("Prado").style.fontWeight='normal';
		document.getElementById("RAV4").style.fontWeight='bold';
		document.getElementById("IMG").height="47";
		document.getElementById("IMG").width="47";
		document.getElementById("IMG").setAttribute("src",img_RAV40);
		document.getElementById("0").innerHTML=txt_RAV40;
		document.getElementById("1").innerHTML=txt_RAV41;
		document.getElementById("2").innerHTML=txt_RAV42;
		document.getElementById("3").innerHTML=txt_RAV43;
		document.getElementById("4").innerHTML=txt_RAV44;
		document.getElementById("5").innerHTML=txt_RAV45;
		document.getElementById("6").innerHTML=txt_RAV46;
	}
}

// パスの定義
DEALERPATH = "/th/DealerPage/Top/default.asp";

function fncVinChg(){
	if(document.Myform.CmbCarVIN.options[document.Myform.CmbCarVIN.selectedIndex].value != '1')
	{
		document.Myform.HidCarVINFlg.value = "1";
		document.Myform.submit();
	}
}
function jsOwlgInit(){
}
function jsOwlg0110Submit(objButton)
{
	objButton.disabled = true;
	document.form01.submit();
}
function fncIndisAlert(strLang) {
	if (strLang == 'th') {
		alert('ข้อมูลที่ท่านกรอกยังไม่สมบูรณ์ กรุณากรอกข้อมูลให้ครบถ้วน');
	}else{
		alert('The indispensable input item is not inputted. Please input.');
	}
	return;
}

function checkInputAlert(strErr,strErrBoxNo) {

	alert(strErr);

	if (strErrBoxNo == '1') {
		document.form1.txtMileage.focus();
	}else if (strErrBoxNo == '2') {
		document.form1.txtFuel.focus();
	}else{
	}
	
	return;
}

function jsOwlg0110Click(strLang) {

		if (strLang == 'th') {
			alert('ฟังก์ชันนี้จะมาเร็วๆนี้');
		}else{
			alert('Under Construction. This function will be launched soon.');
		}

	return false;
}

function fncIndisDateCmbCheck( objYear, objMonth, objDat) {
	if(objYear.options[objYear.selectedIndex].text.length == 0){
			return false;
	}
	if(objMonth.options[objMonth.selectedIndex].text.length == 0){
			return false;
	}
	if(objDat.options[objDat.selectedIndex].text.length == 0){
			return false;
	}
	return true;
}
function mmLoadMenusOwlg(dlrnm,dlrurl) {
	window.menulcnv_1 = new Menu("root",85,16,"Verdana, Arial, Helvetica, sans-serif",11,"#333333","#ffffff","#E8E8E8","#ff6600","left","middle",3,0,100,-5,7,true,true,true,5,false,false);
	menulcnv_1.addMenuItem("Owner Logs","location='/th/OwnerLogs/Top/owlg0110.asp'");
	menulcnv_1.hideOnMouseOut=true;
	menulcnv_1.menuBorder=0;
	menulcnv_1.menuLiteBgColor='#ffffff';
	menulcnv_1.menuBorderBgColor='#ffffff';
	menulcnv_1.bgColor='#ffffff';
	window.menulcnv_2 = new Menu("root",153,16,"Verdana, Arial, Helvetica, sans-serif",11,"#333333","#ffffff","#E8E8E8","#ff6600","left","middle",3,0,100,-5,7,true,true,true,5,false,false);
	menulcnv_2.addMenuItem("Registration Information","location='/th/OwnerLogs/mycarprofile/registration/rgtr0110.asp'");
	menulcnv_2.addMenuItem("Insurance Information","location='/th/OwnerLogs/mycarprofile/insurance/insr0110.asp'");
	menulcnv_2.addMenuItem("Service-in Records","location='/th/OwnerLogs/MyCarProfile/ServiceIn/svin0110.asp'");
	menulcnv_2.hideOnMouseOut=true;
	menulcnv_2.menuBorder=0;
	menulcnv_2.menuLiteBgColor='#ffffff';
	menulcnv_2.menuBorderBgColor='#ffffff';
	menulcnv_2.bgColor='#ffffff';
	window.menulcnv_3 = new Menu("root",150,16,"Verdana, Arial, Helvetica, sans-serif",11,"#333333","#ffffff","#E8E8E8","#ff6600","left","middle",3,0,100,-5,7,true,true,true,5,false,false);
	menulcnv_3.addMenuItem("Diary","location='/th/OwnerLogs/mycardiary/maintehist/mths0110.asp'");
	menulcnv_3.addMenuItem("Maintenance Reminder","location='/th/OwnerLogs/mycardiary/maintealarm/mtar0110.asp'");
	menulcnv_3.hideOnMouseOut=true;
	menulcnv_3.menuBorder=0;
	menulcnv_3.menuLiteBgColor='#ffffff';
	menulcnv_3.menuBorderBgColor='#ffffff';
	menulcnv_3.bgColor='#ffffff';
	window.menulcnv_4 = new Menu("root",85,16,"Verdana, Arial, Helvetica, sans-serif",11,"#333333","#ffffff","#E8E8E8","#ff6600","left","middle",3,0,100,-5,7,true,true,true,5,false,false);
	menulcnv_4.addMenuItem("RMS Message","location='/th/OwnerLogs/rmtmaintenance/rmtm0110.asp'");
	menulcnv_4.hideOnMouseOut=true;
	menulcnv_4.menuBorder=0;
	menulcnv_4.menuLiteBgColor='#ffffff';
	menulcnv_4.menuBorderBgColor='#ffffff';
	menulcnv_4.bgColor='#ffffff';
	window.menulcnv_5 = new Menu("root",150,32,"Verdana, Arial, Helvetica, sans-serif",11,"#333333","#ffffff","#E8E8E8","#ff6600","left","top",2,0,100,-5,7,true,true,true,5,false,false);
	for (var i=0; i<dlrnm.length; i++) {
		menulcnv_5.addMenuItem(dlrnm[i],"location='" + dlrurl[i] + "'" );
	}
//	window.menulcnv_5 = new Menu("root",153,16,"Arial, Helvetica, sans-serif",11,"#333333","#ffffff","#E8E8E8","#ff6600","left","middle",3,0,100,-5,7,true,true,true,5,false,false);
//	menulcnv_5.addMenuItem("Dealer List","location='/th/OwnerLogs/'");
	menulcnv_5.hideOnMouseOut=true;
	menulcnv_5.menuBorder=0;
	menulcnv_5.menuLiteBgColor='#ffffff';
	menulcnv_5.menuBorderBgColor='#ffffff';
	menulcnv_5.bgColor='#ffffff';
	window.menulcnv_6 = new Menu("root",177,16,"Verdana, Arial, Helvetica, sans-serif",11,"#333333","#ffffff","#E8E8E8","#ff6600","left","middle",3,0,100,-5,7,true,true,true,5,false,false);
	menulcnv_6.addMenuItem("Guide","location='/th/OwnerLogs/guide/gide0110.asp'");
	menulcnv_6.hideOnMouseOut=true;
	menulcnv_6.menuBorder=0;
	menulcnv_6.menuLiteBgColor='#ffffff';
	menulcnv_6.menuBorderBgColor='#ffffff';
	menulcnv_6.bgColor='#ffffff';
	menulcnv_6.writeMenus();
}

function OpenDealer1(strDlrCode, strShopCode, strDestId) {

	var strLocation;
	var strDlrCode;
	var strShopCode;
	var strDestId;

	strLocation = DEALERPATH;

	param = "?dealercd=" + strDlrCode + "&branchcd=" + strShopCode + "&destid=" + strDestId;
	param = strLocation + param;

//20060123 REP ポップアップさせないように変更
//	NewWin = window.open(param, "etc_DG", "toolbar=no, location=no, directoryies=no, status=no, menubar=no, resizable=yes, scrollbars=yes");
//	NewWin.window.focus();
//
//	NewWin.location.href = param;

	this.location.href = param;
//20060123 REP

}

function openWindow3(){
window.open("","detail",'status=yes,scrollbars=no,resizable=yes,width=700,height=550');
}