  	
function openWindow(wintype)
{
  var nwl = (screen.width-990)/2;
  var nwh = (screen.height-450)/2;
  popUp=window.open(wintype, 'Popup', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=990,height=450,left='+nwl+',top='+nwh+''); 
  popUp.window.focus(); 
}


function checkKontaktForm(theForm)
{

if(theForm.vorname.value=="") {
	alert("Bitte gebe deinen Vornamen an.");
	theForm.vorname.focus();
	return false;
}
if(theForm.name.value=="") {
	alert("Bitte gebe deinen Namen an.");
	theForm.name.focus();
	return false;
}
if(theForm.email.value==""){
	alert("Bitte gebe deine Emailadresse an.");
	theForm.email.focus();
	return false;
}else if(theForm.email.value.length > 0){
	var emailString = theForm.email.value;
	if (!emailString.match(/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,6}$/i)){
			alert('Die Email-Adresse ist ungültig');
			theForm.email.focus();
			return false;
	}
}
if(theForm.captchaField.value=="") {
	alert("Bitte gebe noch den Buchstabencode an.");
	theForm.captchaField.focus();
	return false;
}
return true;
}


function checkRegistrierungFormular(theForm)
{

if(theForm.Vorname.value=="") {
	alert("Bitte gebe deinen Vornamen an.");
	theForm.Vorname.focus();
	return false;
}
if(theForm.Name.value=="") {
	alert("Bitte gebe deinen Namen an.");
	theForm.Name.focus();
	return false;
}
if(theForm.Email.value==""){
	alert("Bitte gebe deine Emailadresse an.");
	theForm.Email.focus();
	return false;
}else if(theForm.Email.value.length > 0){
	var emailString = theForm.Email.value;
	if (!emailString.match(/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,6}$/i)){
			alert('Die Email-Adresse ist ungültig');
			theForm.Email.focus();
			return false;
	}
}
if(theForm.captcha.value=="") {
	alert("Bitte gebe noch den Buchstabencode an.");
	theForm.captcha.focus();
	return false;
}
return true;
}


function checkBlogFormular(theForm)
{

if(theForm.Überschrift.value=="") {
	alert("Bitte gebe eine Überschrift an.");
	theForm.Überschrift.focus();
	return false;
}
if(theForm.Blogtext.value=="") {
	alert("Bitte gebe den Blogtext an.");
	theForm.Blogtext.focus();
	return false;
}

if(theForm.captcha.value=="") {
	alert("Bitte gebe noch den Buchstabencode an.");
	theForm.captcha.focus();
	return false;
}
return true;
}


function checkKommentarFormular(theForm)
{

if(theForm.Name != null && theForm.Name.value=="") {
	alert("Du mußt deinen Namen angeben.");
	theForm.Name.focus();
	return false;
}
if(theForm.Kommentar.value=="") {
	alert("Bitte gebe ein Kommentartext an.");
	theForm.Kommentar.focus();
	return false;
}

if(theForm.captcha.value=="") {
	alert("Bitte gebe noch den Buchstabencode an.");
	theForm.captcha.focus();
	return false;
}
return true;
}


function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

function changeVotingResults(theForm){

if(document.getElementById("BewertungPunkte") != null && document.getElementById("BewertungStimmen") != null
&& document.getElementById("BewertungPunkteAlt") != null && document.getElementById("BewertungStimmenAlt") != null){

	// Formular wurde ein Votingfeld gewaehlt, Wert auslesen
	var j=0;
	var voteEntry = 0;
	j = theForm.punkte.length;

	for (var i=0; i<j; i++)
	{
	 if(theForm.punkte[i].checked)
	 {
		voteEntry = theForm.punkte[i].value;
	 }
	}
	// wert gesetzt? dann Felder schreiben
	if(voteEntry > 0){
	  // neue Werte berechnen und setzen
	  var intBewertungPunkteAlt = 0;
	  var intBewertungStimmenAlt = 0;
	  if(document.getElementById("BewertungPunkteAlt").value != "" && parseInt(document.getElementById("BewertungPunkteAlt").value) > 0) intBewertungPunkteAlt = parseInt(document.getElementById("BewertungPunkteAlt").value)
	  if(document.getElementById("BewertungStimmenAlt").value != "" && parseInt(document.getElementById("BewertungStimmenAlt").value) > 0) intBewertungStimmenAlt = parseInt(document.getElementById("BewertungStimmenAlt").value)
	  
	  document.getElementById("BewertungPunkte").value = parseInt(voteEntry)+intBewertungPunkteAlt;
	  document.getElementById("BewertungStimmen").value = 1+intBewertungStimmenAlt;
	  
	  return true;
	}else return false;
} else return false;
}


function checkNewsletter(theForm)
{
/*
if(theForm.rubrik != null && !theForm.rubrik.checked) {
	alert("Du mußt eine abbonierte Rubrik angeben.");
	return false;
}
*/
if(theForm.ansprech.value=="") {
	alert("Bitte geb deinen kompletten Namen an.");
	theForm.ansprech.focus();
	return false;
}

if(theForm.email.value==""){
	alert("Bitte gebe deine Emailadresse an.");
	theForm.email.focus();
	return false;
}else if(theForm.email.value.length > 0){
	var emailString = theForm.email.value;
	if (!emailString.match(/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,6}$/i)){
			alert('Die Email-Adresse ist ungültig');
			theForm.email.focus();
			return false;
	}
}
return true;
}
