function getWindowHeight()
{
    var windowHeight=0;
    if (typeof(window.innerHeight)=='number') {
        windowHeight=window.innerHeight;
    } else {
        if (document.documentElement&&document.documentElement.clientHeight) {
            windowHeight=document.documentElement.clientHeight;
        } else {
            if (document.body&&document.body.clientHeight) {
                windowHeight=document.body.clientHeight;
            }
        }
    }
	
    return windowHeight;
}

function setFooter()
{
    if (document.getElementById) {
        var windowHeight=getWindowHeight();
        if (windowHeight>0) {
            var containerHeight=document.getElementById('container').offsetHeight;
            var footerElement=document.getElementById('footer');
            var footerHeight=footerElement.offsetHeight;
            if (windowHeight-(containerHeight+footerHeight)>=0) {
                footerElement.style.position='relative';
                footerElement.style.top=(windowHeight-(containerHeight+footerHeight))+'px';
            } else {
                footerElement.style.position='static';
            }
        }
    }
}

function checkBox(btn,fieldName)
{
    var field=btn.form.elements[fieldName];
    if (typeof btn.check=='undefined') {
        btn.check=true;
    }
    if (typeof field.length=='undefined') {
        field.checked=btn.check;
    } else {
        for (i=0; i<field.length; i++) {
            field[i].checked=btn.check;
        }
    }

    if (!btn.check) {
        btn.value="+";
        btn.check=true;
    } else {
        btn.value="-";
        btn.check=false;
    }
}

function rowRadio(checkid,rowid,count)
{
    window.setTimeout("colorizeRowRadio('"+checkid+"','"+rowid+"','"+count+"')",100);
    return true;
}

function colorizeRowRadio(idcheckcommon,idrowcommon,count)
{
    for (i=1; i<=count; i++) {
        idrow=""+idrowcommon+i;
        idcheck=""+idcheckcommon+i;
        document.getElementById(idrow).className=((document.getElementById(idcheck).checked)?"checked":"unchecked");
    }
}

function toggle(an,aus)
{
    document.getElementById(an).style.display='inline';
    document.getElementById(aus).style.display='none';
}

function openWindow(theURL,winName,features)
{
window.open(theURL,winName,features).focus()
}

function fensterle(theURL,winName,features)
{
    if (fenster&&fenster.closed==false) {
		fenster=window.open(theURL,winName,features);
        fenster.focus();
    } else {
        fenster=window.open(theURL,winName,features);
	    fenster.focus();
	}
}

function getSelectedCheckbox(buttonGroup) {
   // Go through all the check boxes. return an array of all the ones
   // that are selected (their position numbers). if no boxes were checked,
   // returned array will be empty (length will be zero)
   var retArr = new Array();
   var lastElement = 0;
   if (buttonGroup[0]) { // if the button group is an array (one check box is not an array)
      for (var i=0; i<buttonGroup.length; i++) {
         if (buttonGroup[i].checked) {
            retArr.length = lastElement;
            retArr[lastElement] = i;
            lastElement++;
         }
      }
   } else { // There is only one check box (it's not an array)
      if (buttonGroup.checked) { // if the one check box is checked
         retArr.length = lastElement;
         retArr[lastElement] = 0; // return zero as the only array value
      }
   }
   return retArr;
} // Ends the "getSelectedCheckbox" function

    function doSubmit(aktion,formular,popup) {
	   var formular=formular;
	   document.forms[formular].action = aktion;
	   if(popup == true) {
	   document.forms[formular].target = 'bestellen';
       displayWindow = openWindow(aktion,'bestellen','menubar=no,scrollbars=yes,resizable=yes,width=360,height=480');
	   }else{
	   document.forms[formular].target = '_self';
	   }
       document.forms[formular].submit();
	   return false;
    }

function init() {
if (parent.location.href != self.location.href)
parent.location=self.location;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function validate_form(formular,id) {

if(formular.name == 'propaganda') {       
// Sender
   if(document.propaganda.elements['propaganda[sendername]'].value == "") {
   alert("Bitte geben Sie Ihren Namen an!");
   document.propaganda.elements['propaganda[sendername]'].focus();
   return false;
   }

// Sender-E-Mail
   if(document.propaganda.elements['propaganda[sendermail]'].value == "") {
   alert("Bitte geben Sie Ihre E-Mail-Adresse ein!");
   document.propaganda.elements['propaganda[sendermail]'].focus();
   return false;
   }
   
   if(document.propaganda.elements['propaganda[sendermail]'].value.indexOf('@') == -1) {
   alert("Bitte geben Sie eine gültige E-Mail-Adresse ein!");
   document.propaganda.elements['propaganda[sendermail]'].focus();
   return false;
   }

// Empfänger
   if(document.propaganda.elements['propaganda[empfaengername]'].value == "") {
   alert("Bitte geben Sie den Namen des Empfängers an!");
   document.propaganda.elements['propaganda[empfaengername]'].focus();
   return false;
   }

// Empfänger-E-Mail
   if(document.propaganda.elements['propaganda[empfaengermail]'].value == "") {
   alert("Bitte geben Sie die E-Mail-Adresse des Empfängers ein!");
   document.propaganda.elements['propaganda[empfaengermail]'].focus();
   return false;
   }
   
   if(document.propaganda.elements['propaganda[empfaengermail]'].value.indexOf('@') == -1) {
   alert("Bitte geben Sie eine gültige E-Mail-Adresse ein!");
   document.propaganda.elements['propaganda[empfaengermail]'].focus();
   return false;
   }

// Nachricht
   if(document.propaganda.elements['propaganda[nachricht]'].value == "") {
   alert("Bitte geben Sie Ihre Nachricht ein!");
   document.propaganda.elements['propaganda[nachricht]'].focus();
   return false;
   }
  
// Captcha
   if(document.propaganda.elements['propaganda[flood]'].value == "") {
   alert("Bitte geben Sie den Sicherheitscode an!");
   document.propaganda.elements['propaganda[flood]'].focus();
   return false;
   }
}
   
// Formular versenden
   document.getElementById(''+id+'').submit();     
} // end of function