function getNewXMLHTTP() { try { return window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { new ActiveXObject("Msxml2.XMLHTTP"); } } function cestparti() { url="index.php"; urlUpdated= window.location.href.substr(window.location.href.lastIndexOf("/")+1,window.location.href.length); if (urlUpdated=="") urlUpdated= url; xmlhttp = getNewXMLHTTP(); xmlhttp.onreadystatechange = triggerIdent; datas=formData2QueryString(document.ident); xmlhttp.open("POST", urlUpdated, true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.setRequestHeader("Content-length", datas.length); xmlhttp.setRequestHeader("Cache-Control", "no-cache"); xmlhttp.setRequestHeader("Connection", "close"); xmlhttp.send(datas); return false; } function triggerIdent() { if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) { if (!xmlhttp.responseText.indexOf("location")) { window.location.href = xmlhttp.responseText.substr(9,xmlhttp.responseText.length); } else { document.getElementById("message").innerHTML = xmlhttp.responseText; } } } function formData2QueryString(docForm) { var strSubmit = ''; var formElem; var strLastElemName = ''; for (i = 0; i < docForm.elements.length; i++) { formElem = docForm.elements[i]; switch (formElem.type) { case 'text': case 'hidden': case 'password': strSubmit += formElem.name + '=' + encodeURIComponent(formElem.value) + '&' break; } } return strSubmit; }