	var az_p_dirty, rb_p_dirty, rw_p_dirty;
	var az_dirty, rb_dirty, rw_dirty;
	var kmW_dirty, focusfield;
	
	function checkfields() {
		var msg="";
		
		if (typeof(document.forms[0].FZGNAME) == "object") {
			if (document.forms[0].FZGNAME.value == "") {
				if (document.forms[0].weg.value=="KFZ") {
					msg = getName(cNameSAVE_KLKFZG);
				} else {
					msg = getName(cNameSAVE_KLKSFO);
				}
				focusfield=document.forms[0].FZGNAME;
			}
		}
		return(msg);
	}

	function kfzart_change() {
		 if (document.forms[0].inpKFZART.options[document.forms[0].inpKFZART.selectedIndex].value==id_kfzart_gebr)
		 {
			document.forms[0].EXW.value=0;
			document.forms[0].inpEXW.value=0;
		 }
	
	}
	
	function changeModule(module, div) {
		switch(module) {
			case "TYP":
				document.forms[0].action="../kfzktl/showTYP.asp";
				document.forms[0].div.value=div;
				break;
			case "WAR":
				document.forms[0].action="../sfoktl/showWAR.asp";
				break;
			case "MRK":
				document.forms[0].action="../kfzmrk/showMRK.asp";
				break;
			case "SOA":
				document.forms[0].action="../kfzktl/showSOA.asp";
				document.forms[0].div.value=div;
				break;
			case "saveKLK":
				if (TYP_MDL != mdl_bar) {
					if (typeof(document.forms[0].inpID_MDL) != "object") return;
					if (typeof(document.forms[0].inpLFZ) != "object") return;
				}
				var msg = checkfields();
				if (msg != "") {
					alert(msg);
					if (typeof(focusfield)=="object") focusfield.focus();
					return;
				}
				checkInput();
				document.forms[0].NEXTFORM.value="loadKLK.asp";
				document.forms[0].method = "post";
				document.forms[0].action="saveKLK.asp";
				break;
			case "SearchWAR":
				document.forms[0].action="../sfoktl/searchWAR.asp";
				break;
			case "SearchKFZ":
				document.forms[0].action="../kfzktl/searchTYP.asp";
				break;
			case "SearchMRK":
				document.forms[0].action="../kfzmrk/searchMRK.asp";
				break;
			case "PRINTKLK":
				if (TYP_MDL != mdl_bar) {
					if (typeof(document.forms[0].inpID_MDL) != "object") return;
					if (typeof(document.forms[0].inpLFZ) != "object") return;
				}
				var msg = checkfields();
				if (msg != "") {
					alert(msg);
					if (typeof(focusfield)=="object") focusfield.focus();
					return;
				}
				checkInput();
				document.forms[0].PRINTRPT.value="true";
				document.forms[0].NEXTFORM.value="editKLK.asp";
				document.forms[0].method = "post";
				document.forms[0].action="saveKLK.asp";
				break;
		}
		submitform("");
	}

	function checkInput() {
		if (typeof(document.forms[0].inpID_MDL) != "object") return;

		if ((az_p_dirty) && (typeof(document.forms[0].inpAZ) == "object")) {
			document.forms[0].inpAZ.value="";
		}
		if ((rw_p_dirty) && (typeof(document.forms[0].inpFV) == "object")) {
			document.forms[0].inpFV.value="";
		}
		if ((rb_p_dirty) && (typeof(document.forms[0].inpRB) == "object")) {
			document.forms[0].inpRB.value="";
		}
		if ((az_dirty) && (typeof(document.forms[0].inpAZp) == "object")) {
			document.forms[0].inpAZp.value="";
		}
		if ((rw_dirty) && (typeof(document.forms[0].inpFVp) == "object")) {
			document.forms[0].inpFVp.value="";
		}
		if ((rb_dirty) && (typeof(document.forms[0].inpRBp) == "object")) {
			document.forms[0].inpRBp.value="";
		}
		
		if (kmW_dirty) {
			document.forms[0].KMChange.value="true";
		} else {
			document.forms[0].KMChange.value="false";
		}
	}	

	function submitforkalk(sCol) {
		checkInput();
		document.forms[0].action="editKLK.asp#kalk";
		document.forms[0].inpsCol.value=sCol;
		submitform("");
	}
	
	function submitform(clear) {
		if (clear != "") clearfields();

		switch(clear) {
			case "clearall":
				document.forms[0].sCol.value="";
				document.forms[0].inpsCol.value="";
				if (typeof(document.forms[0].inpMwSt) == "object") document.forms[0].inpMwSt.selectedIndex=-1;
				if (typeof(document.forms[0].inpVTA) == "object") document.forms[0].inpVTA.selectedIndex=-1;
				if (typeof(document.forms[0].inpID_MDL) == "object") document.forms[0].inpID_MDL.selectedIndex=-1;
				if (typeof(document.forms[0].inpLFZ) == "object") document.forms[0].inpLFZ.selectedIndex=-1;
				if (typeof(document.forms[0].LFZ) == "object") document.forms[0].LFZ.value="";
				if (typeof(document.forms[0].inpKMST) == "object") document.forms[0].inpKMST.value="";
				if (typeof(document.forms[0].KMST) == "object") document.forms[0].KMST.value="";
				if (typeof(document.forms[0].inpKFZEZ) == "object") document.forms[0].inpKFZEZ.value="";
				if (typeof(document.forms[0].KFZEZ) == "object") document.forms[0].KFZEZ.value="";
				document.forms[0].KMChange.value="true";
				break;
			case "clearmdl":
				document.forms[0].sCol.value="";
				document.forms[0].inpsCol.value="";
				if (typeof(document.forms[0].inpMwSt) == "object") document.forms[0].inpMwSt.selectedIndex=-1;
				if (typeof(document.forms[0].inpID_MDL) == "object") document.forms[0].inpID_MDL.selectedIndex=-1;
				if (typeof(document.forms[0].inpLFZ) == "object") document.forms[0].inpLFZ.selectedIndex=-1;
				if (typeof(document.forms[0].LFZ) == "object") document.forms[0].LFZ.value="";
				document.forms[0].KMChange.value="true";
				break;
			case "clears_lfz":
				document.forms[0].sCol.value="";
				document.forms[0].inpsCol.value="";
				if (typeof(document.forms[0].inpLFZ) == "object") document.forms[0].inpLFZ.selectedIndex=-1;
				if (typeof(document.forms[0].LFZ) == "object") document.forms[0].LFZ.value="";
				document.forms[0].KMChange.value="true";
				break;
			case "clear_fields":
				document.forms[0].sCol.value="";
				document.forms[0].inpsCol.value="";
				break;
		}
		document.forms[0].submit();
	}

	function checkADR_onclick() {
		if (!document.forms[0].checkADR.checked) {
			if (typeof(document.forms[0].inpADR) == "object") document.forms[0].inpADR.value="false";
		}else{
			if (typeof(document.forms[0].inpADR) == "object") document.forms[0].inpADR.value="true";
		}
	}

	function checkDIF_onclick() {
		if (!document.forms[0].checkDIF.checked) {
			if (typeof(document.forms[0].inpDIF) == "object") document.forms[0].inpDIF.value="false";
		}else{
			if (typeof(document.forms[0].inpDIF) == "object") document.forms[0].inpDIF.value="true";
		}
	}
	
	function checkRSV_onclick() {
		if (!document.forms[0].checkRSV.checked) {
			if (typeof(document.forms[0].inpRSV) == "object") document.forms[0].inpRSV.value="false";
			if(typeof(document.forms[0].checkAUV) == "object") document.forms[0].checkAUV.checked=false;
			if (typeof(document.forms[0].inpAUV) == "object") document.forms[0].inpAUV.value="false";
			if(typeof(document.forms[0].checkALV) == "object") document.forms[0].checkALV.checked=false;
			if (typeof(document.forms[0].inpALV) == "object") document.forms[0].inpALV.value="false";
		}else{
			if (typeof(document.forms[0].inpRSV) == "object") document.forms[0].inpRSV.value="true";
		}
		document.forms[0].submit();
	}

	function checkAUV_onclick() {
		if (!document.forms[0].checkAUV.checked) {
			if (typeof(document.forms[0].inpAUV) == "object") document.forms[0].inpAUV.value="false";
		} else {
			if (typeof(document.forms[0].inpAUV) == "object") document.forms[0].inpAUV.value="true";
			if (!document.forms[0].checkRSV.checked) {
				document.forms[0].checkRSV.checked=true;
				if (typeof(document.forms[0].inpRSV) == "object") document.forms[0].inpRSV.value="true";
			}
		}
		if (!document.forms[0].checkAUV.checked) {
			if (typeof(document.forms[0].checkALV) == "object") document.forms[0].checkALV.checked=false;
			if (typeof(document.forms[0].inpALV) == "object") document.forms[0].inpALV.value="false";
		}
		document.forms[0].submit();
	}
	
	function checkALV_onclick() {
		if (!document.forms[0].checkALV.checked) {
			if (typeof(document.forms[0].inpALV) == "object") document.forms[0].inpALV.value="false";
		} else {
			if (typeof(document.forms[0].inpALV) == "object") document.forms[0].inpALV.value="true";
			if (!document.forms[0].checkAUV.checked) {
				document.forms[0].checkAUV.checked=true;
				if (typeof(document.forms[0].inpAUV) == "object") document.forms[0].inpAUV.value="true";
				if (!document.forms[0].checkRSV.checked) {
					document.forms[0].checkRSV.checked=true;
					if (typeof(document.forms[0].inpRSV) == "object") document.forms[0].inpRSV.value="true";
				}				
			}
		}
		document.forms[0].submit();
	}

	function checkTSV_onclick() {
		if (!document.forms[0].checkTSV.checked) {
			if (typeof(document.forms[0].inpTSV) == "object") document.forms[0].inpTSV.value="false";
		}else{
			if (typeof(document.forms[0].inpTSV) == "object") document.forms[0].inpTSV.value="true";
		}
	}

	function checkRFS_onclick() {
		if (!document.forms[0].checkRFS.checked) {
			if (typeof(document.forms[0].inpRFS) == "object") document.forms[0].inpRFS.value="false";
		}else{
			if (typeof(document.forms[0].inpRFS) == "object") document.forms[0].inpRFS.value="true";
		}
	}

	function checkTKA_onclick() {
		if (!document.forms[0].checkTKA.checked) {
			if (typeof(document.forms[0].inpTKA) == "object") document.forms[0].inpTKA.value="false";
		}else{
			if (typeof(document.forms[0].inpTKA) == "object") document.forms[0].inpTKA.value="true";
		}
	}

	function checkGEZ_onclick() {
		if (!document.forms[0].checkGEZ.checked) {
			if (typeof(document.forms[0].inpGEZ) == "object") document.forms[0].inpGEZ.value="false";
		}else{
			if (typeof(document.forms[0].inpGEZ) == "object") document.forms[0].inpGEZ.value="true";
		}
	}
	
	function checkSTE_onclick() {
		if (!document.forms[0].checkSTE.checked) {
			if (typeof(document.forms[0].inpSTE) == "object") document.forms[0].inpSTE.value="false";
		}else{
			if (typeof(document.forms[0].inpSTE) == "object") document.forms[0].inpSTE.value="true";
		}
	}

	function checkKVI_onclick() {
		if (!document.forms[0].checkKVI.checked) {
			if (typeof(document.forms[0].inpKVI) == "object") document.forms[0].inpKVI.value="false";
		}else{
			if (typeof(document.forms[0].inpKVI) == "object") document.forms[0].inpKVI.value="true";
		}
	}

	function checkGAP_onclick() {
		if (!document.forms[0].checkGAP.checked) {
			if (typeof(document.forms[0].inpGAP) == "object") document.forms[0].inpGAP.value="false";
		}else{
			if (typeof(document.forms[0].inpGAP) == "object") document.forms[0].inpGAP.value="true";
		}
	}

	function checkASS_onclick() {
		if (!document.forms[0].checkASS.checked) {
			if (typeof(document.forms[0].inpASS) == "object") document.forms[0].inpASS.value="false";
		}else{
			if (typeof(document.forms[0].inpASS) == "object") document.forms[0].inpASS.value="true";
		}
	}

	function clearfields() {
		var i;
		
		document.forms[0].sCol.value="";
		document.forms[0].KMChange.value="true";
		if (typeof(document.forms[0].inpZE_E) == "object") document.forms[0].inpZE_E.value="";
		if (typeof(document.forms[0].inpAZ) == "object") document.forms[0].inpAZ.value="";
		if (typeof(document.forms[0].inpAZp) == "object") document.forms[0].inpAZp.value="";
		if (typeof(document.forms[0].inpPM) == "object") document.forms[0].inpPM.value="";
		if (typeof(document.forms[0].inpKM) == "object") document.forms[0].inpKM.value="";
		if (typeof(document.forms[0].inpFV) == "object") document.forms[0].inpFV.value="";
		if (typeof(document.forms[0].inpFVp) == "object") document.forms[0].inpFVp.value="";
		if (typeof(document.forms[0].inpRB) == "object") document.forms[0].inpRB.value="";
		if (typeof(document.forms[0].inpRBp) == "object") document.forms[0].inpRBp.value="";
		if (typeof(document.forms[0].inpXCode) == "object") document.forms[0].inpXCode.value="";
		if (typeof(document.forms[0].inpPCode) == "object") document.forms[0].inpPCode.value="";
		if (typeof(document.forms[0].inpRCode) == "object") document.forms[0].inpRCode.value="";
		if (typeof(document.forms[0].inpZCode) == "object") document.forms[0].inpZCode.value="";
		if (typeof(document.forms[0].ZE_E) == "object") document.forms[0].ZE_E.value="";
		if (typeof(document.forms[0].AZ) == "object") document.forms[0].AZ.value="";
		if (typeof(document.forms[0].AZp) == "object") document.forms[0].AZp.value="";
		if (typeof(document.forms[0].PM) == "object") document.forms[0].PM.value="";
		if (typeof(document.forms[0].KM) == "object") document.forms[0].KM.value="";
		if (typeof(document.forms[0].FV) == "object") document.forms[0].FV.value="";
		if (typeof(document.forms[0].FVp) == "object") document.forms[0].FVp.value="";
		if (typeof(document.forms[0].RB) == "object") document.forms[0].RB.value="";
		if (typeof(document.forms[0].RBp) == "object") document.forms[0].RBp.value="";
		if (typeof(document.forms[0].XCode) == "object") document.forms[0].XCode.value="";
		if (typeof(document.forms[0].PCode) == "object") document.forms[0].PCode.value="";
		if (typeof(document.forms[0].RCode) == "object") document.forms[0].RCode.value="";
		if (typeof(document.forms[0].ZCode) == "object") document.forms[0].ZCode.value="";
		if (typeof(document.forms[0].inpVVD) == "object") document.forms[0].inpVVD.checked=false;
		if (typeof(document.forms[0].inpID_PVS) == "object") document.forms[0].inpID_PVS.value="";
		if (typeof(document.forms[0].RSV) == "object") document.forms[0].RSV.value="";
		if (typeof(document.forms[0].inpRSV) == "object") document.forms[0].inpRSV.value="";
		if (typeof(document.forms[0].AUV) == "object") document.forms[0].AUV.value="";
		if (typeof(document.forms[0].inpAUV) == "object") document.forms[0].inpAUV.value="";
		if (typeof(document.forms[0].ALV) == "object") document.forms[0].ALV.value="";
		if (typeof(document.forms[0].inpALV) == "object") document.forms[0].inpALV.value="";
		if (typeof(document.forms[0].ID_DKA) == "object") document.forms[0].ID_DKA.value="";
		if (typeof(document.forms[0].inpID_DKA) == "object") document.forms[0].inpID_DKA.selectedIndex=-1;
		if (typeof(document.forms[0].TSV) == "object") document.forms[0].TSV.value="";
		if (typeof(document.forms[0].inpTSV) == "object") document.forms[0].inpTSV.value="";
		if (typeof(document.forms[0].TKA) == "object") document.forms[0].TKA.value="";
		if (typeof(document.forms[0].inpTKA) == "object") document.forms[0].inpTKA.value="";
		if (typeof(document.forms[0].ID_TKA) == "object") document.forms[0].ID_TKA.value="";
		if (typeof(document.forms[0].RFS) == "object") document.forms[0].RFS.value="";
		if (typeof(document.forms[0].inpRFS) == "object") document.forms[0].inpRFS.value="";
		if (typeof(document.forms[0].RFS_S_anz) == "object") document.forms[0].RFS_S_anz.value="";
		if (typeof(document.forms[0].RFS_W_anz) == "object") document.forms[0].RFS_W_anz.value="";
		if (typeof(document.forms[0].ID_RFS_SV) == "object") document.forms[0].ID_RFS_SV.value="";
		if (typeof(document.forms[0].ID_RFS_WV) == "object") document.forms[0].ID_RFS_WV.value="";
		if (typeof(document.forms[0].ID_RFS_SH) == "object") document.forms[0].ID_RFS_SH.value="";
		if (typeof(document.forms[0].ID_RFS_WH) == "object") document.forms[0].ID_RFS_WH.value="";
		if (typeof(document.forms[0].GEZ) == "object") document.forms[0].GEZ.value="";
		if (typeof(document.forms[0].inpGEZ) == "object") document.forms[0].inpGEZ.value="";
		if (typeof(document.forms[0].ID_GEZ) == "object") document.forms[0].ID_GEZ.value="";
		if (typeof(document.forms[0].STE) == "object") document.forms[0].STE.value="";
		if (typeof(document.forms[0].inpSTE) == "object") document.forms[0].inpSTE.value="";
		if (typeof(document.forms[0].ID_STE) == "object") document.forms[0].ID_STE.value="";
		if (typeof(document.forms[0].GAP) == "object") document.forms[0].GAP.value="";
		if (typeof(document.forms[0].inpGAP) == "object") document.forms[0].inpGAP.value="";
		if (typeof(document.forms[0].ASS) == "object") document.forms[0].ASS.value="";
		if (typeof(document.forms[0].inpASS) == "object") document.forms[0].inpASS.value="";
		if (typeof(document.forms[0].KVI) == "object") document.forms[0].KVI.value="";
		if (typeof(document.forms[0].inpKVI) == "object") document.forms[0].inpKVI.value="";
		if (typeof(document.forms[0].ID_HP) == "object") document.forms[0].ID_HP.value="";
		if (typeof(document.forms[0].ID_VK) == "object") document.forms[0].ID_VK.value="";
	}
		
	function cleardata() {
		submitform("clear_fields");
	}

	function changeMwSt(optTyp) {
		submitforkalk(optTyp);
	}

