/* form checkers in Contact page */
function checkForm_de() {
        var bCheck = true;
        if (document.contact.name.value == "") { bCheck = false; }
        if (document.contact.vorname.value == "") { bCheck = false; }
        if (document.contact.strasse.value == "") { bCheck = false; }
        if (document.contact.plz.value == "") { bCheck = false; }
        if (document.contact.ort.value == "") { bCheck = false; }
        if (document.contact.land.value == "") { bCheck = false; }

        if (!bCheck)
        {
        alert("Bitte füllen Sie alle mit * bezeichneten Felder aus.");
        }
        return bCheck;
}




/* toggle div id blocks */
function togglethis(thistoggle)
{
     if (document.getElementById(thistoggle).style.display == "block")
     {
     document.getElementById(thistoggle).style.display = "none";
     return true;
     }

     if (document.getElementById(thistoggle).style.display == "none")
     {
     document.getElementById(thistoggle).style.display = "block";
     return true;
     }
}





/* limit user input in textareas */
function textcounter(field, countfield, maxlimit)
{
if (field.value.length > maxlimit)
     {
     field.value = field.value.substring(0, maxlimit);
     }
     else
     {
     countfield.value = maxlimit - field.value.length;
     }
}




// workaround for Norton, see http://www.webmasterworld.com/forum91/1696-3-10.htm
if(window.SymError)
{
window.onerror=null;
}




/* for IE, set focus for form input fields via script not just CSS */
sfFocus = function()
{
var sfEls = document.getElementsByTagName("INPUT");
     for (var i=0; i<sfEls.length; i++)
     {
          sfEls[i].onfocus=function()
          {
          this.className+=" sffocus";
          }
          sfEls[i].onblur=function()
          {
          this.className=this.className.replace(new RegExp(" sffocus\\b"), "");
          }
     }
}
if (window.attachEvent) window.attachEvent("onload", sfFocus);





/* remove background flicker in IE6 */
try
{
document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}




//softscrollto_topofpage
function backToTop()
{
var x1 = x2 = x3 = 0;var y1 = y2 = y3 = 0;
     if (document.documentElement)
     {
     x1 = document.documentElement.scrollLeft || 0;
     y1 = document.documentElement.scrollTop || 0;
     }
     if (document.body)
     {
     x2 = document.body.scrollLeft || 0;
     y2 = document.body.scrollTop || 0;
     }
x3 = window.scrollX || 0;y3 = window.scrollY || 0;
var x = Math.max(x1, Math.max(x2, x3));
var y = Math.max(y1, Math.max(y2, y3));
window.scrollTo(Math.floor(x / 2), Math.floor(y / 2));
     if (x > 0 || y > 0)
     {
     window.setTimeout("backToTop()", 25);
     }
}





/* AHAH 1.0 / AJAX */
var http_request = false;

function sendajaxrequest(phpscript, parameters)
{

http_request = false;

if (window.XMLHttpRequest) // Mozilla, Safari,...
{
     http_request = new XMLHttpRequest();
     if (http_request.overrideMimeType)
     {
     http_request.overrideMimeType('text/xml');
     }
} else if (window.ActiveXObject) // IE
{
     try
     {
     http_request = new ActiveXObject("Msxml2.XMLHTTP");
     } catch (e) {
     try {
     http_request = new ActiveXObject("Microsoft.XMLHTTP");
     } catch (e) {}
     }
}

http_request.onreadystatechange = alertiferror;
http_request.open('POST', phpscript, true);
http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
http_request.send(parameters);
}

function alertiferror()
{
if (http_request.readyState == 4)
     {
     if (http_request.status == 200)
     {
          // only alert warning if PHP script has produced an error
          if (http_request.responseText != 0)
          {
          alert(http_request.responseText);
          document.registerform.redemptioncode.value='';
          }
     }
}

}
