function handleResponse(content)
{
	if(content.match(/erfolgreich/g))hideMailLayer();
	alert(content);
}
function request(url, postParam, getParam, targetId){
  var req = null;
  url += ".php";
  try{req = new XMLHttpRequest();}
  catch (e){
    try{req = new ActiveXObject("Msxml2.XMLHTTP");}
    catch (e){
     try{req = new ActiveXObject("Microsoft.XMLHTTP");}
     catch (e){req = null;}
    }
  }
  if (req == null) return;
  if(postParam != null)req.open("POST", url + "?" + getParam, true);
  else req.open("GET", url + "?" + getParam, true);
  req.onreadystatechange =function(){
    switch(req.readyState) {
     case 4:
      if(req.status!=200) {return;}
      else{
	    if(targetId == 'mail')handleResponse(req.responseText);
	    else if(typeof targetId != "undefined" && targetId != "")document.getElementById(targetId).innerHTML = req.responseText;

    }
     break;
     default:
      return false;
     break;
    }
  };
  req.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
  if(postParam != null){
    req.setRequestHeader("Content-length", postParam.length);
    req.setRequestHeader("Connection", "close");
  }
  req.send(postParam);
}


