function setIds(wertS,wertC) {
	document.formAdmin.id_s.value=wertS;
	document.formAdmin.id_c.value=wertC;
	document.formAdmin.submit();
}

function setAdm(wert) {
	document.formAdmin.adm.value=wert;
	document.formAdmin.edit.value=2;
	document.formAdmin.id.value='';
	document.formAdmin.showform.value='';
	if(document.formAdmin.kat) {
		document.formAdmin.kat.value='';
	}
	if(document.formAdmin.mainKat) {
		document.formAdmin.mainKat.value='';
	}
	document.formAdmin.submit();
}

function setEdit(wert) {
	document.formAdmin.edit.value=wert;
	document.formAdmin.showform.value='';
	document.formAdmin.submit();
}

function setReg(wert) {
	document.formAdmin.reg.value=wert;
	if(document.formAdmin.id_file) {
		document.formAdmin.id_file.value='';
	}
	document.formAdmin.submit();
}

function setKat(wert) {
	document.formAdmin.kat.value=wert;
	document.formAdmin.submit();
}

function setMainKat(wert) {
	document.formAdmin.mainKat.value=wert;
	if(document.formAdmin.kat) {
		document.formAdmin.kat.value='';
	}
	document.formAdmin.submit();
}

function showForm(wert,wert2) {
	document.formAdmin.showform.value=wert;
	if(wert2) {
		document.formAdmin.showformSwitch.value=wert2;
	}
	if(!wert2) {
		document.formAdmin.showformSwitch.value='';
	}
	if(wert>0) {
  	if(document.formAdmin.id_file) {
  		document.formAdmin.id_file.value=wert;
  	}
  	if((document.formAdmin.id) && (!document.formAdmin.id_file)) {
  		document.formAdmin.id.value=wert;
  	}
  } else {
  	if(document.formAdmin.id_file) {
  		document.formAdmin.id_file.value='';
  	}
  	if(document.formAdmin.id) {
  		document.formAdmin.id.value='';
  	}
  	if(document.formAdmin.reg) {
			document.formAdmin.reg.value='';
  	}
  }
	document.formAdmin.submit();
}

function delMain(wert) {
	document.formAdmin.sent.value=3;
	document.formAdmin.id.value=wert;
	document.formAdmin.submit();
}

function delKat(wert1,wert2) {
	document.formAdmin.sent.value=3;
	document.formAdmin.id.value=wert1;
	document.formAdmin.delKatInt.value=wert2;
	document.formAdmin.submit();
}

function delFile(wert) {
	document.formAdmin.sent.value=23;
	document.formAdmin.id_file.value=wert;
	document.formAdmin.submit();
}

function switchSent(wert,was) {
	switch(was) {
  case 1:
		document.formAdmin.sent.value=wert;
		document.formAdmin.submit();
		break;
	}
}

function dateiF(pfad) {

	p = '' + pfad.replace(/\\/g, '/'); // To unix style
	p = p.substring(p.lastIndexOf('/') + 1);

	var eingabe = document.forms['formAdmin'];
	var displayRow = document.getElementById('rowFileTermName');
	eingabe.dateiname.value = p;
	if(eingabe.filename) {
	  eingabe.filename.value = p;
	  displayRow.style.display='block';
	}
}

function newSide(wert,was,toScroll) {
	switch(was) {
		case 1:
			document.formAdmin.limit_von.value=wert;
			document.formAdmin.submit();
			break;
		case 2:
			document.formAdmin.limit_von.value=wert;
			document.formAdmin.start_seite.value=wert-toScroll;
			document.formAdmin.submit();
			break;
		case 3:
			document.formAdmin.limit_von.value=wert;
			document.formAdmin.start_seite.value=wert;
			document.formAdmin.submit();
			break;
	}
}

function checklogin() {
	if(document.login.username.value=="") {
		alert("Bitte Benutzernamen eingeben !");
		document.login.username.focus();
		return;
	}
	if(document.login.kwort.value=="") {
		alert("Bitte Kennwort eingeben !");
		document.login.kwort.focus();
		return;
	}
	document.login.submit();
}

function chkform_article(wert) {
	document.formAdmin.sent.value=wert;
	document.formAdmin.submit();
}

function chkform_news(wert) {
	if(document.formAdmin.head.value=="") {
		alert("Bitte Überschrift eingeben !");
		document.formAdmin.head.focus();
		return;
	}
	if(document.formAdmin.tag) {
	  if(document.formAdmin.tag.value == ""){
	    alert("Bitte einen Tag (Bsp: 01) eingeben!");
	    document.formAdmin.tag.focus();
	    return;
	  }
	  if(document.formAdmin.jahr.value == ""){
	    alert("Bitte ein Jahr eingeben!");
	    document.formAdmin.jahr.focus();
	    return;
	  }
	}
  if(wert) {
  	document.formAdmin.sent.value=2;
  } else {
  	document.formAdmin.sent.value=1;
  }
	document.formAdmin.submit();
}

function chkform_builder(wert) {
	if(document.formAdmin.bauherr.value=="") {
		alert("Bitte Bauherrname eingeben !");
		document.formAdmin.bauherr.focus();
		return;
	}
  if(wert) {
  	document.formAdmin.sent.value=2;
  } else {
  	document.formAdmin.sent.value=1;
  }
	document.formAdmin.submit();
}

function chkform_station(wert) {
	if(document.formAdmin.ort.value=="") {
		alert("Bitte Ort eingeben !");
		document.formAdmin.ort.focus();
		return;
	}
  if(wert) {
  	document.formAdmin.sent.value=2;
  } else {
  	document.formAdmin.sent.value=1;
  }
	document.formAdmin.submit();
}

function chkform_pro(wert) {
	if(wert==-1) {
		document.formAdmin.sent.value=4;
	} else {
		var test = false;
		var r = new RegExp('^'+'rubrik');
		for (i=1; i < document.formAdmin.elements.length; i++) {
			if (document.formAdmin.elements[i].name.match(r)) {
				if (document.formAdmin.elements[i].checked) {
					test = true;
					break;
				}
			}
		}
		if(test == false) {
			alert("Bitte min. eine Rubrik auswählen");
			return;
		}
		if(document.formAdmin.pname.value == ""){
	    alert("Bitte einen Projektnamen eingeben");
		  document.formAdmin.pname.focus();
		  return;
	  }
	  if(document.formAdmin.jahr_von.value == ""){
	    alert("Bitte ein Jahr eingeben!");
	    document.formAdmin.jahr_von.focus();
	    return;
	  }
	  if(wert) {
	  	document.formAdmin.sent.value=2;
	  } else {
	  	document.formAdmin.sent.value=1;
	  }
	}
	document.formAdmin.submit();
}

function chkform_menu(wert) {
	if(document.formAdmin.buttonname.value=="") {
		alert("Bitte Buttonname eingeben !");
		document.formAdmin.buttonname.focus();
		return;
	}
  if(wert) {
  	document.formAdmin.sent.value=2;
  } else {
  	document.formAdmin.sent.value=1;
  }
	document.formAdmin.submit();
}

function chkform_imp() {
	if(document.formAdmin.firma.value == "") {
  	alert("Bitte eine Firma eingeben");
		document.formAdmin.firma.focus();
		return;
	}
	prw=document.formAdmin.email.value.toLowerCase();
	if(prw!="" ) {
		for (i=0;i<prw.length;++i) {
	  	if(((prw.substr(i,1)==prw.substr(i+1,1)) &&  ((prw.substr(i,1)=='-') || (prw.substr(i,1)=='.') || (prw.substr(i,1)=='_')) || (((prw.substr(i,1)=='_')||(prw.substr(i,1)=='.')||(prw.substr(i,1)=='-')||(prw.substr(i,1)=='@') ) && ((prw.substr(i+1,1)=='_')||(prw.substr(i+1,1)=='.')||(prw.substr(i+1,1)=='-')||(prw.substr(i+1,1)=='@') ))   ) || (((prw.substr(i,1)<'a') || (prw.substr(i,1)>'z')) && ((prw.substr(i,1)>'9') || (prw.substr(i,1)<'0')) && (prw.substr(i,1)!='@') && (prw.substr(i,1)!='.') && (prw.substr(i,1)!='-') && (prw.substr(i,1)!='_'))) {
	    	alert("Bitte E-mail Adresse überprüfen!");
				document.formAdmin.email.focus();
				return;
	    };
		}
		if ((prw.length<6) || (((prw.split('.')).length)<=1) || (((prw.split('@')).length)>2) || (((prw.split('@')).length)<=1) || (prw.substr(0,1)=='@')  || (prw.substr(0,1)=='.')  || (prw.substr(0,1)=='_') || ( prw.length-prw.lastIndexOf('.')  < 3 ) || ( prw.length-prw.lastIndexOf('.')  > 5 ) || (prw.lastIndexOf('.')-prw.lastIndexOf('@')<3) || ( prw.substr(prw.lastIndexOf('@'),prw.lastIndexOf('.')).lastIndexOf('_') != -1) || ( prw.substr(prw.lastIndexOf('.'),prw.length).lastIndexOf('-') != -1)) {
    	alert("Bitte E-mail Adresse überprüfen!");
	  	document.formAdmin.email.focus();
	  	return;
	  }
	}
	document.formAdmin.sent.value=2;
	document.formAdmin.submit();
}

function chkform_file(wert) {
  if((document.formAdmin.appname) && (document.formAdmin.appname.value == "")) {
	  alert("Bitte einen Titel eingeben!");
	  document.formAdmin.appname.focus();
	  return;
	}
  if(document.formAdmin.filename.value == "") {
	  alert("Bitte ein Foto auswählen.");
	  document.formAdmin.filename.focus();
	  return;
	}
  if(wert) {
  	document.formAdmin.sent.value=22;
  } else {
  	document.formAdmin.sent.value=21;
  }
	document.formAdmin.submit();
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function toogle(mode,upon,shut) {
  var zu = document.getElementById(shut);
	var auf = document.getElementById(upon);
	if (zu && auf) {
	    if (mode) {
			zu.style.display='none';
			auf.style.display='';
		} else {
			zu.style.display='';
			auf.style.display='none';
		}
	}
}

function expande(preview) {
	$(preview).addClassName('isdetail');
	var content = $('contentBoxContainer');
	content.addClassName('detailmode');
	content.update(content.innerHTML);//wegen IE Bug
}

function collapse(preview) {
	$(preview).removeClassName('isdetail');
	var content = $('contentBoxContainer');
	content.removeClassName('detailmode');
	content.update(content.innerHTML);//wegen IE Bug
}
