var wphc_loaded = false; //addLoadEvent(aufOuSxyEGwgvqFRJ); function load_hashcash() { aufOuSxyEGwgvqFRJ(); } function overloadOnsubmitHandler(){ var e = document.getElementById('commentform'); e.onsubmit = checkLoadedStatus; if (e.captureEvents) e.captureEvents(Event.SUBMIT); } function checkLoadedStatus(e){ if (!e) var e = window.event; if(!wphc_loaded){ alert('Wordpress Hashcash has not finished downloading information from the server. Please wait and try again in a few momemnts.'); return false; } else { return true; } } function createHiddenField(){ var inp = document.createElement('input'); inp.setAttribute('type', 'hidden'); inp.setAttribute('id', 'yGRraVxs'); inp.setAttribute('name', 'hashcash_value'); inp.setAttribute('value', '-1'); var e = document.getElementById('commentform'); e.appendChild(inp); } function addVerbage(){ var e = document.getElementById('commentform'); var p = document.createElement('p'); p.innerHTML = ''; e.appendChild(p); } function aufOuSxyEGwgvqFRJ(){ overloadOnsubmitHandler(); createHiddenField(); //addVerbage(); loadHashCashKey('http://www.potty-training-in-one-day.com/wp-content/plugins/wp-hashcash/wp-hashcash-getkey.php', 'yGRraVxs'); } function loadHashCashKey(fragment_url, e_id) { var xmlhttp=createXMLHttp(); var element = document.getElementById(e_id); xmlhttp.open("GET", fragment_url); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { element.value = eval(xmlhttp.responseText); wphc_loaded = true; } } xmlhttp.send(null); } function createXMLHttp() { if (typeof XMLHttpRequest != "undefined") return new XMLHttpRequest(); var xhrVersion = [ "MSXML2.XMLHttp.5.0", "MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0", "MSXML2.XMLHttp","Microsoft.XMLHttp" ]; for (var i = 0; i < xhrVersion.length; i++) { try { var xhrObj = new ActiveXObject(xhrVersion[i]); return xhrObj; } catch (e) { } } return null; } /* function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { func(); oldonload(); } } } */