var timeValue = 5; var timer = timeValue * 1000 * 60; var refreshWidth = 130; var labelText = 'Type in the code (expires in ' + (timer / 60000) + ' minutes)'; var url = 'http://www.pridesites.com/cgi-bin/user/captcha.cgi?action=image'; //self-adjusting timer abstraction function doTimer(length, resolution, oninstance, oncomplete) { var steps = (length / 100) * (resolution / 10), speed = length / steps, count = 0, start = new Date().getTime(); function instance() { if(count++ == steps) { oncomplete(steps, count); } else { oninstance(steps, count); var diff = (new Date().getTime() - start) - (count * speed); window.setTimeout(instance, (speed - diff)); } } window.setTimeout(instance, speed); } function startCountDown() { var img = document.getElementById('captcha_img'); document.getElementById('resetCode').style.display = 'none'; document.getElementById('submitForm').style.display = 'block'; document.getElementById('f_captcha').style.display = 'block'; document.getElementById('captcha_txt').firstChild.nodeValue = labelText; var opacity = 1; img.style.opacity = opacity; doTimer(timer, 20, function(steps) { opacity = opacity - (1 / steps); img.style.opacity = opacity; }, function() { img.style.display = 'none'; document.getElementById('resetCode').style.display = 'block'; document.getElementById('submitForm').style.display = 'none'; document.getElementById('f_captcha').style.display = 'none'; document.getElementById('captcha_txt').firstChild.nodeValue = 'The code to send this message has expired.'; }); } function updateCAPTCHA() { var img = document.getElementById('captcha_img'); img.src = url; img.style.display = 'inline'; startCountDown(); } function initCountDown() { if (document.getElementById('captcha_img')!=undefined) { document.getElementById('captcha_txt').firstChild.nodeValue = labelText; document.getElementById('resetCode').onclick = function () { updateCAPTCHA(); } document.getElementById('submitForm').onclick = function () { var test = document.getElementById('comments'); if (test.value.length>0) { return true; } else { alert ('Please fill in the comments'); return false; } } startCountDown(); } } window.init = initCountDown(); // Dreamweaver function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i