/* ********************************************************************************************
 * dnDataEdit
 ******************************************************************************************* */
	function dnRecordNew(side, formName, get) {
		var p;  d=document;
		var get = (!get) ? '' : get;
		side = (side) ? side : window.location.pathname;
		
		if((p=side.indexOf("?"))>0&&(parent.frames.length||document.frames.length)) {
			d=window.frames[side.substring(p+1)];
			//if(!d){d=document.frames[side.substring(p+1)].document;}
			if(!d){d=parent.frames[side.substring(p+1)]; }
			d = d.document;
			side=side.substring(0,p);
		}
		
		var sPath = d.location.pathname;
		//var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);
		var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);

		if (d.forms[formName] && d.forms[formName].formState.value!="new") {
			d.location.replace(side+"?formState=new&rsID=0"+get);
		} else if (sPage!=side) {
			d.location = side+"?formState=new&rsID=0"+get;
		} else {
			alert('Sie sind bereits auf einem neuen Datensatz.');
		}
	}
	
	function dnRecordEdit(side, rsID, get) {
		var p;  d=document;
		var get = (!get) ? '' : get;
		side = (side) ? side : window.location.pathname;
		if((p=side.indexOf("?"))>0&&(parent.frames.length||document.frames.length)) {
			d=parent.frames[side.substring(p+1)]; 
			if(!d){d=document.frames[side.substring(p+1)];}
			side=side.substring(0,p);d.document;
		}
		
		if (rsID>0) {
			d.location.replace(side+"?formState=edit&rsID="+rsID+get);
		} else {
			alert('Sie haben keinen Datensatz in der Liste makiert.');
		}
	}
	
	

	function dnRecordSave(formName, noSubmit) {
		var oFormName = MM_findObj(formName);
		if (oFormName) {
			oFormName.formCmd.value='save';
			noSubmit = (!noSubmit) ? false : true;
			if (noSubmit==false) {
				oFormName.onsubmit();
				oFormName.submit();
			}
		} else {
			alert('Daten konnten nicht gespeichert werden!');
		}
	}



	function dnRecordDelete(side, formName, getParam) {
		side = (side) ? side : window.location.pathname;
		formName = (formName) ? formName : 'formDataEdit';
		getParam = (getParam) ? getParam : '';
		var oFormName = MM_findObj(formName);
		
		if (oFormName && oFormName.rsID.value>0) {
			if (oFormName.formState.value=='delete') {
				window.location.href = side+"?formCmd=delete&rsID="+oFormName.rsID.value+getParam;
			} else {
				window.location.href = side+"?formState=delete&rsID="+oFormName.rsID.value+getParam;
			}
		} else {
			alert('Kein Datensatz ausgewählt!');
		}
	}


	function dnRecordSort(rsID, count, parentID) {
		var side = window.location.pathname;
		var parent = (parentID>0) ? '&parent='+parentID : '';
		document.location.replace(side+'?ct='+rsID+'&cf='+count+parent);
	}
	
	
	// Vorschau Funktion -- TODO noch nicht in Klasse integriert
	function dnRecordPreview(formName, notsubmit) {
		var oFormName = MM_findObj(formName);
		var sm = (!notsubmit) ? 0 : notsubmit;
		
		if (oFormName) {
			oFormName.formCmd.value="preview";
			if (sm==0) {
				oFormName.onsubmit();
				oFormName.submit();
			}
		} else {
			alert('Voransicht nicht m&ouml;glich!');
		}
	}
	

function dn_viewDS(side) {
		var x = MM_findObj('rsID?frmDaten');
		if (x.value>0) {
			parent.frmMembers.location.href = side+'rsID='+x.value;
		} else {
			alert('Sie haben keinen Datensatz in der Liste makiert.');
		}
	}

	function dnRecordReload(side) {
		/*var x = MM_findObj('rsID');
		side = (side) ? side : window.location.pathname;
		if (x.value>0) {
			window.location.replace(side+'?rsID='+x.value);
		} else {
			alert('Sie haben keinen Datensatz in der Liste makiert.');
		}*/
		window.location.reload(true);
	}




	function dnCopyRecord(notsubmit, frm) {
		if (!frm) { var frm = MM_findObj('formDataEdit'); };
		sm = (!notsubmit) ? 0 : notsubmit;
		if (frm && frm.formState.value!="new") {
			Check = confirm("Datensatz wirklich kopieren?");
			if (Check==true) {
				frm.formCmd.value='copy';
				if (sm==0) {
					frm.onsubmit();
					frm.submit();
				}
			}
		} else {
			alert('Datensatz kann nicht kopiert werden!');
		}
	}

	function dn_back(side) {
		parent.frmMembers.location.href = side;
	}


	function dn_noright(text) {
		if (text=="") {
			alert(text);
		} else {
			alert("Sie haben keine Berechtigung für diese Funktion!");
		}
	}


/* ********************************************************************************************
 * dn_dbtool_table
 ******************************************************************************************* */
	
	function dn_lvw_deleteDS3(frm) {
		var x = MM_findObj(frm);
		if (x) {
			if (x.formState.value=='delete') {
				x.formCmd.value='delete';
			} else {
				x.formState.value='delete';
			}
			x.onsubmit();
			x.submit();
		} else {
			alert('Beim Löschen ist ein Fehler aufgetreten!');
		}
	}
	
	function dn_lvw_back1(side) {
		window.location.href = side;
	}

