function setCookie(name,value) {
  var separator = "; ";
  var now = new Date();
  var expires = new Date(now.getTime() + (1000*60*60*24*365));
  var path = '/';
  var cookievalue = name + "=" + escape(value) + separator + ((expires) ? "expires=" + expires.toGMTString() : "") + separator + ((path) ? "path=" + path : "") + separator;
  document.cookie = cookievalue;
  if(!document.cookie) {
    alert("Cookies abgeschaltet :-(");
  }
}

function switchLanguage(strOld,strNew) {
  var strOld, strNew;
  var strLocation = self.location.href;
  if(strLocation.indexOf("&lang=") > 0) {
    strLocation = strLocation.replace(strOld,strNew);
    if(strLocation.indexOf("&offer=") > 0) {
      strLocation = strLocation.substr(0,strLocation.length - 21);
    }
  }
  else {
    if(strLocation.indexOf(".php") < 1) {
      strLocation += "index.php?" + strNew;
    }
    else {
      strLocation += "?" + strNew;
    }
  }
  location.href = strLocation;
}

function checkRequest(strLanguage) {
  if(document.request.realname.value == "") {
    if(strLanguage == 'eng') {
      alert('Please fill in your name.');
    }
    else {
      alert('Bitte Namen eingeben.');
    }
    document.request.realname.focus();
    return false;
  }
  if(document.request.email.value == "" || document.request.email.value.indexOf('@') == -1 || document.request.email.value.indexOf('.') == -1) {
    if(strLanguage == 'eng') {
      alert('Please fill in your E-Mail address.');
    }
    else {
      alert('Bitte E-Mail Adresse eingeben.');
    }
    document.request.email.focus();
    return false;  
  }
  else {
    return true;
  }
}