var captcha_form; for(i=0;i -1 || cod>-1)){ if(arr[i].type=="select-one" || arr[i].type=="select-multiple"){ chk=arr[i].options[arr[i].selectedIndex].value; }else if(arr[i].type=="radio"){ chk=1; }else if(arr[i].type=="checkbox"){ chk=arr[i].checked; }else if(nm.indexOf("_*_confirm")>0){ fld=nm.replace("_*_confirm","_*"); if(fld=document.getElementById(fld)){ if(arr[i].value==fld.value && arr[i].value) { chk=1; }else{ arr[i].value=""; chk=0; } } }else{ chk=arr[i].value; } if(arr[i].style.border){ arr[i].style.border="#cccccc 2px solid"; } if (chk==0 || chk=='00.00.00' ){ arr[i].style.border="#ff0000 2px solid"; if(focusi==-1) focusi=i; ret=false; } } } if(ret){ if(cod>-1){ ret=checkcaptcha(arr[cod].value); } if(ret==1){ return true; }else{ arr[cod].style.border="2px solid #FF0000"; arr[cod].value=""; arr[cod].focus(); return false; } }else{ try{ arr[focusi].focus(); } catch(err){} return false; } } function checkcaptcha(val) { var http_request = false; url="/captcha.php"; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); } } 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('Giving up :( Cannot create an XMLHTTP instance'); return false; } http_request.open('POST', url, false); http_request.send(val); if(http_request.responseText==-1){ alert('Cookie must be enabled!'); return 0; } return http_request.responseText; }