var ajaxActive = false; var captchas = new Array(); function captchaSubmit(id, outId, type, item, validationFunction) { if (!ajaxObject) { var ajaxScript = document.createElement('script'); ajaxScript.setAttribute('type', 'text/javascript'); ajaxScript.setAttribute('src', 'sys/js/ajax.js'); document.getElementsByTagName('head').item(0).appendChild(ajaxScript); } if (ajaxObject == null) document.write('Cannot init ajax handler. Update your browser or check your settings.'); else if (document.getElementById(id)) { if (ajaxActive == false) { ajaxActive = true; if (!document.getElementById('captchaDiv_'+id)) { captchas[captchas.length] = "captchaSubmit('"+id+"', '"+outId+"', '"+type+"', '"+item+"', "+validationFunction+");"; eval("var captchaDiv_"+id+" = document.createElement('div');"); eval("captchaDiv_"+id+".setAttribute('id', 'captchaDiv_"+id+"');"); eval("document.getElementById('"+id+"').appendChild(captchaDiv_"+id+");"); } else eval("var captchaDiv_"+id+" = document.getElementById('captchaDiv_"+id+"');"); ajaxObject.open('GET', 'sys/misc/captcha.php', true); ajaxObject.onreadystatechange = function () { if (this.readyState == 4) { eval("captchaDiv_"+id+".innerHTML=this.responseText;"); var form = document.getElementById(id); document.getElementById(id).onsubmit = function () { if (typeof(validationFunction) == 'function' && validationFunction()) return false; postVars = getPostVars(form); eval("var writtenCaptcha = captchaDiv_"+id+".childNodes.item(0).childNodes.item(3).value;"); setTimeout("updateCaptchas();", 2500); return httpGetFile('', outId, 'POST', postVars+'ajaxRequestedType='+type+'&ajaxRequestedItem='+item); } ajaxActive = false; } } ajaxObject.send(null); } else { setTimeout("captchaSubmit('"+id+"', '"+outId+"', '"+type+"', '"+item+"', "+validationFunction+");", 100); } } } function updateCaptchas() { for (var i = 0; i