function resizeSpacer() {
    var s=document.getElementById('vspacer');
    if (s!=null && window.innerHeight && window.innerHeight>190) {
       s.height=window.innerHeight-190;
       s.width=1;    
    } else {
       if ( document.body && document.body.offsetHeight && document.body.offsetHeight>190) {
          s.height=document.body.offsetHeight-190;
	  s.width=1;    
       }
    }
	// resize content if possible
    var c=document.getElementById('hspacer');
    if (c!=null && window.innerWidth && window.innerWidth >1000) {
       c.width=window.innerWidth-410;
    } else {
       if ( document.body && document.body.offsetWidth && document.body.offsetWidth>1000) {
	     c.width=window.document.body.offsetWidth-410;
       }
    }
    return true;
}

function nlc(el,ct,cd,sg) {
	var e = window.encodeURIComponent ? encodeURIComponent : escape;
	el.href="http://www.netluchs.de/url?sa=t&ct="+e(ct)+"&cd="+e(cd)+"&url="+e(el.href).replace(/\+/g,"%2B")+"&ei=af20184937605e8e87805f905ee0f268"+sg;
	el.onmousedown="";
	return true;
}

function ShowTip(fArg)
{
        var tooltipOBJ = (document.getElementById) ? document.getElementById('tt-' + fArg) : ((document.all) ? document.all("tt-" + fArg) : null);

        if (tooltipOBJ != null) {
                var tooltipLft = 80;
                var tooltipTop = 180;
                if (navigator.appName == 'Netscape') {
                        if (parseFloat(navigator.appVersion) >= 5) { 
                              tooltipTop = document.body.scrollTop+100;
                        }
                        tooltipOBJ.style.left = tooltipLft; 
                        tooltipOBJ.style.top = tooltipTop;
                } else {
//                        tooltipTop = event.clientY+50;
                        tooltipOBJ.style.pixelLeft = tooltipLft; 
                        tooltipOBJ.style.pixelTop = tooltipTop;
                }
                tooltipOBJ.style.visibility = "visible";
        } 
}

function HideTip(fArg)
{
        var tooltipOBJ;
        if (fArg >0) {
                tooltipOBJ = (document.getElementById) ? document.getElementById('tt-' + fArg ) : eval("document.all['tt-" + fArg + "']");
                if (tooltipOBJ != null) {
                        tooltipOBJ.style.visibility = "hidden";
                }
        } else {
                for (i=0;i<50;i++) { 
                        tooltipOBJ = (document.getElementById) ? document.getElementById('tt-' + i ) : eval("document.all['tt-" + i + "']");
                        if (tooltipOBJ != null) {
                                tooltipOBJ.style.visibility = "hidden";
                        }       
                }
        }
}
// validates that the field value string has one or more characters in it
function isNotEmpty(elem) {
	var str = elem.value;
    var re = /.+/;
    if(!str.match(re)) {
        alert("Bitte füllen Sie die benötigten (mit einem '*' gekennzeichneten) Felder aus.");
        setTimeout("focusElement('" + elem.form.name + "', '" + elem.name + "')", 0);
        return false;
    } else {
        return true;
    }
}
//validates that the entry is a positive or negative number
function isNumber(elem) {
	var str = elem.value;
    var re = /^[-]?\d*\.?\d*$/;
    str = str.toString();
    if (!str.match(re)) {
        alert("Bitte nutzen Sie in dem Feld nur Ziffern.");
        setTimeout("focusElement('" + elem.form.name + "', '" + elem.name + "')", 0);
        return false;
    }
    return true;
}
// validates that the entry is 16 characters long
function isLen16(elem) {
	var str = elem.value;
    var re = /\b.{16}\b/;
    if (!str.match(re)) {
        alert("Das Feld darf nicht mehr als 16 Zeichen lang sein.");
        setTimeout("focusElement('" + elem.form.name + "', '" + elem.name + "')", 0);
        return false;
    } else {
        return true;
    }
}
// validates that the entry is formatted as an e-mail address
function isEMailAddr(elem) {
	var str = elem.value;
    var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
    if (!str.match(re)) {
        alert("Bitte prüfen Sie nocheinmal Ihre E-Mail-Adresse.");
        setTimeout("focusElement('" + elem.form.name + "', '" + elem.name + "')", 0);
        return false;
    } else {
        return true;
    }
}
// validate that the user made a selection other than default
function isChosen(select) {
    if (select.selectedIndex == 0) {
        alert("Bitte wählen Sie einen Eintrag aus der Liste.");
        return false;
    } else {
        return true;
    }
}

// validate that the user has checked one of the radio buttons
function isValidRadio(radio) {
    var valid = false;
    for (var i = 0; i < radio.length; i++) {
        if (radio[i].checked) {
            return true;
        }
    }
    alert("Bitte wählen Sie etwas aus.");
    return false;
}

function focusElement(formName, elemName) {
    var elem = document.forms[formName].elements[elemName];
    elem.focus();
    elem.select();
}

// batch validation router
function validateForm(form) {
       if (isNotEmpty(form.required_name)) {
            if (isNotEmpty(form.required_telefon)) {
                if (isEMailAddr(form.required_email)) {
                      return true;
                }
            }
        }
    return false;
}

// validate that the user made a selection other than default
function isChosenMandant(select) {
    if (select.selectedIndex == 0) {
        alert("Bitte wählen Sie eine Reichweite und einen Status aus der Liste aus.");
        return false;
    } else {
        return true;
    }
}

// validiere WebsiteEingabe
function validateWebsiteForm(form) {
  if (! isChosenMandant(form.idMandant)) {
	return false;
  }
  return true;
}


// rueckfrage: frage, ob die Aktion wirklich durchgeführt werden soll
function nachfragenText(target) {
  if ( (text=window.prompt("Sind Sie sicher? Wollen Sie einen Kommentar hinterlegen?",""))) {
    location.replace(target+"&websiteBeschreibung="+text);
  } else {
  };
}

// rueckfrage: frage, ob die Aktion wirklich durchgeführt werden soll
function nachfragen(target) {
  if ( window.confirm("Sind Sie sicher?")) {
    location.replace(target);
  } else {
   
  };
}
