function antiSpamMail(name,sld,tld) {
	var at = "@";
	window.location.href = "mailto:" + name + at + sld + "." + tld;
}

function __doPostBack(varD,varM,varY,varNavM,varNavY) {
	var theform;
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		theform = document.f;
	}
	else {
		theform = document.forms["f"];
	}
	theform.__DAY.value = varD;
	theform.__MON.value = varM;
	theform.__YEA.value = varY;
	theform.__navMON.value = varNavM;
	theform.__navYEA.value = varNavY;
	theform.submit();
}

function __changeName() {
	var theform;
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		theform = document.f;
	}
	else {
		theform = document.forms["f"];
	}
	if("Voransicht zeigen" == theform.ansehen.value) {
		theform.ansehen.value = "Newsletter versenden";		
	} else {
		theform.ansehen.value = "Voransicht zeigen";
	}
}

function __delEntry(varId, varAction, varCon) {
	var theform;
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		theform = document.f;
	}
	else {
		theform = document.forms["f"];
	}
	theform.__ID.value = varId;
	theform.__ACTION.value = varAction;
	theform.__CONTENT.value = varCon;
	theform.submit();
}

function __editEntry(varId) {
	var theform;
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		theform = document.f;
	}
	else {
		theform = document.forms["f"];
	}
	theform.__ID.value = varId;
	theform.__ACTION.value = "edit";
	theform.submit();
}

function __addDesc(varPicid) {
	var theform;
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		theform = document.f;
	}
	else {
		theform = document.forms["f"];
	}

	if (0 < theform.seq.value.length) {
		varSeq = Number(theform.seq.value);
		if (isNaN(varSeq)) {
			alert("Eingabe für Reihung ungültig!");
		} else {
			theform.__ID.value = varPicid;
			theform.__ACTION.value = "update";
		}
	} else {
		alert("Keine Reihung angegeben!");
		theform.seq.focus();		
	}
	theform.submit();
}

function __picUpload() {
	var theform;
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		theform = document.f;
	}
	else {
		theform = document.forms["f"];
	}

	if ("" == trim(theform.file_upload.value)) {
		alert("Bitte ein Bild auswählen!");
		theform.file_upload.focus();
		return false;
	}
	theform.__ACTION.value = "new";
	theform.submit();
}

function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}

function __chkNewItem () {
	var theform;
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		theform = document.f;
	}
	else {
		theform = document.forms["f"];
	}

	if ("" == trim(theform.content.value)) {
		alert("Bitte eine Kurzbeschreibung eingeben!");
		theform.content.focus();
		return false;
	}
	if('undefined' != typeof theform.typeid) {
		if (-1 == theform.typeid.value) {
			alert("Bitte einen Berichtsart auswählen!");
			theform.type.focus();
			return false;
		}
	}
	if ("" == theform.date.value) {
		alert("Bitte im Kalender ein Datum auswählen!");
		return false;
	}
	if (0 < theform.time.value.length) {
		parts = theform.time.value.split(":");
		if (2 == parts.length && 
			0 < trim(parts[0]).length && 
			3 > trim(parts[0]).length && 
			0 < trim(parts[1]).length &&
			3 > trim(parts[1]).length ) {
			hour = Number(parts[0]);
			min = Number(parts[1]);		
		} else {
			alert("Bitte Uhrzeit korrekt eingeben!");
			theform.time.focus();
			return false;	
		}
		if (
			isNaN(hour) ||
			isNaN(min)  ||
			hour   <  0 ||
			hour   > 23 ||
			min    <  0 ||
			min    > 59		
			) {
			alert("Bitte Uhrzeitangabe prüfen!");
			theform.time.focus();
			return false;
		} else {
			theform.time.value = trim(parts[0]) + ":" + trim(parts[1]);
		}
	}
	theform.__NEW.value = "1";
}

function __chkNewDep() {
	var theform;
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		theform = document.f;
	}
	else {
		theform = document.forms["f"];
	}

	if ("" == trim(theform.content.value)) {
		alert("Bitte einen Namen eingeben!");
		theform.content.focus();
		return false;
	}
	theform.__NEW.value = "1";
}

function __selFolder(varFolder, varSteps) {
	var theform;
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		theform = document.f;
	}
	else {
		theform = document.forms["f"];
	}
	theform.__FOLDER.value = varFolder;
	theform.__STEPS.value  = varSteps;
	theform.submit();
}

function __delFolder(varFolder, varDel, varSteps) {
	var theform;
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		theform = document.f;
	}
	else {
		theform = document.forms["f"];
	}
	theform.__FOLDER.value    = varFolder;
	theform.__DELFOLDER.value = varDel;
	theform.__STEPS.value     = varSteps;
	theform.submit();
}

function __delPic(varFolder, varDel, varSteps) {
	var theform;
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		theform = document.f;
	}
	else {
		theform = document.forms["f"];
	}
	theform.__FOLDER.value = varFolder;
	theform.__DELPIC.value = varDel;
	theform.__STEPS.value  = varSteps;
	theform.submit();
}