var http_request = false;
if (!http_request && typeof XMLHttpRequest != 'undefined') {
  http_request = new XMLHttpRequest();
}

function makePOSTRequest(url, parameters) {
document.getElementById("formwrapper").innerHTML = '<img src="http://friseur-lounge.de/inc.img/progress3.gif" border="0" width="50px" height="50px" title="Progress&#133;"/>';
   http_request = false;
   if (window.XMLHttpRequest) { // Mozilla, Safari,...
      http_request = new XMLHttpRequest();
   } else if (window.ActiveXObject) { // IE
      try {
         http_request = new ActiveXObject("Msxml2.XMLHTTP");
      } catch (e) {
         try {
            http_request = new ActiveXObject("Microsoft.XMLHTTP");
         } catch (e) {}
      }
   }
   if (!http_request) {
      alert('Cannot create XMLHTTP instance');
      return false;
   }
   http_request.onreadystatechange = alertContents;
   http_request.open('POST', url, true);
   http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   http_request.setRequestHeader("Content-length", parameters.length);
   http_request.setRequestHeader("Connection", "close");
   http_request.send(parameters);
}
/*
function makePOSTRequest(url, parameters) {
   http_request = false;
   if (!http_request && typeof XMLHttpRequest != 'undefined') {
     http_request = new XMLHttpRequest();
   }
   http_request.onreadystatechange = alertContents;
   http_request.open('POST', url, true);
   http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   http_request.setRequestHeader("Content-length", parameters.length);
   http_request.setRequestHeader("Connection", "close");
   http_request.send(parameters);
}
*/
/*
function makePOSTRequest(url, parameters) {
   http_request = false;
   if (window.XMLHttpRequest) { // Mozilla, Safari,...
      http_request = new XMLHttpRequest();
      if (http_request.overrideMimeType) {
          // set type accordingly to anticipated content type
         //http_request.overrideMimeType('text/xml');
         http_request.overrideMimeType('text/html');
      }
   } else if (window.ActiveXObject) { // IE
      try {
         http_request = new ActiveXObject("Msxml2.XMLHTTP");
      } catch (e) {
         try {
            http_request = new ActiveXObject("Microsoft.XMLHTTP");
         } catch (e) {}
      }
   }
   if (!http_request) {
      alert('Cannot create XMLHTTP instance');
      return false;
   }
   http_request.onreadystatechange = alertContents;
   http_request.open('POST', url, true);
   http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   http_request.setRequestHeader("Content-length", parameters.length);
   http_request.setRequestHeader("Connection", "close");
   http_request.send(parameters);
}
*/
function handleEnter(field, event) {
        var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
        if (keyCode == 13) {
            var i;
            for (i = 0; i < field.form.elements.length; i++)
                if (field == field.form.elements[i])
                    break;
            i = (i + 1) % field.form.elements.length;
            field.form.elements[i].focus();
            return false;
        }
        else
        return true;
    }
function alertContents() {
   if (http_request.readyState == 4) {
      if (http_request.status == 200) {
         //alert(http_request.responseText);
         result = http_request.responseText;
         document.getElementById('formwrapper').innerHTML = result;
      } else {
         alert('There was a problem with the request.\nPlease use the alternate: admin@promediafactory.com');
      }
   }
}
function get(obj) {
  var poststr = "";
  for (i=0; i<obj.childNodes.length; i++) {
      for (k=0; k<obj.childNodes[i].childNodes.length; k++) {
           var sel = obj.childNodes[i].childNodes[k];
           if (sel.tagName == "LEGEND") {
              poststr += sel.name + "=" + encodeURI(sel.firstChild.nodeValue) + "&";
           }
           if (sel.tagName == "SELECT") {
              poststr += sel.name + "=" + encodeURI(sel.options[sel.selectedIndex].value) + "&";
           }
           if (sel.tagName == "TEXTAREA") {
              poststr += sel.name + "=" + encodeURI(sel.value) + "&";
           }

           if (sel.tagName == "INPUT") {
              if (sel.type == "text") {
                 poststr += sel.name + "=" + encodeURI(sel.value) + "&";
              }
              if (sel.type == "hidden") {
                 poststr += sel.name + "=" + encodeURI(sel.value) + "&";
              }
              if (sel.type == "checkbox") {
                 if (sel.checked) {
                    poststr += sel.name + "=" + encodeURI(sel.value) + "&";
                 } else {
                    poststr += sel.name + "=&";
                 }
              }
              if (sel.type == "radio") {
                 if (sel.checked) {
                    poststr += sel.name + "=" + encodeURI(sel.value) + "&";
                 }
              }
           }
      }
  }
  makePOSTRequest('A555B819E3ED4B60AB09BC87FD78DD4C.php', poststr);
}

function FDA25BE0D9F0463891F27AE5D0CA1C2D(guid) {
  get(document.getElementById(guid), 'left');
}
function reloadCaptcha() {
  var sign = String.fromCharCode(183);
  document.getElementById("frm_newcode").setAttribute("disabled", "true");
  document.getElementById("frm_newcode").setAttribute("disabled", "disabled");
  document.getElementById("frm_newcode").setAttribute("value", sign+sign+sign);
  document.getElementById("code").setAttribute("disabled", "true");
  document.getElementById("code").setAttribute("disabled", "disabled");
  document.getElementById("code").setAttribute("value", "");
  document.getElementById("code").className = "disabled txtBox2";
//  document.getElementById("frm_newcode").style.visibility = "hidden";
  document.getElementById("lala").innerHTML = '<img src="http://friseur-lounge.de/inc.img/progress2.gif" style="padding-top: 3px;" border="0" width="16px" height="16px" title="Progress&#133;" alt""/>';
  window.setTimeout('writeNewCaptcha()',1500);
  window.setTimeout('activateNewCaptcha()',1800);
}
function writeNewCaptcha() {
  var time = new Date();
  document.getElementById("lala").innerHTML = '<img src="inc/captcha/captcha.php?'+time+'" border="0" title="" alt""/>';
}
function activateNewCaptcha() {
//  document.getElementById("frm_newcode").style.visibility = "visible";
  document.getElementById("frm_newcode").setAttribute("disabled", null);
  document.getElementById("frm_newcode").setAttribute("value", "Neuer Code.");
  document.getElementById("frm_newcode").removeAttributeNode(document.getElementById("frm_newcode").getAttributeNode("disabled"));
  document.getElementById("code").setAttribute("disabled", null);
  document.getElementById("code").removeAttributeNode(document.getElementById("code").getAttributeNode("disabled"));
  document.getElementById("code").setAttribute("value", "");
  document.getElementById("code").className = "required txtBox2";
  document.getElementById("code").focus();
}