var puzzlename = ''; function loadPuzzle(name,x,y) { puzzlename = name; var url = "puzzleserver.php"; // var url = new String(document.URL); // url = url.replace("puzzlepage.php","puzzleserver.php"); var http_request = false; 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) { return false; } var data = ''; data += "&cmd=" + "create"; data += "&db=" + puzzlename; data += "&x=" + x; data += "&y=" + y; http_request.onreadystatechange = function() { alertContents(http_request); }; http_request.open('POST', url, true); http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); http_request.send(data); } // loadPuzzle function reportClick(id) { var url = new String(document.URL); url = "puzzleserver.php"; var http_request = false; 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) { return false; } var data = ''; data += "&cmd=" + "click"; data += "&db=" + puzzlename; data += "&id=" + id; http_request.onreadystatechange = function() { alertContents(http_request); }; http_request.open('POST', url, true); http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); http_request.send(data); } // recordClick function alertContents(http_request) { if(http_request.readyState == 4 && http_request.status == 200) { var xmldoc = http_request.responseXML; document.getElementById("puzzlebox").innerHTML = http_request.responseText; } } // alertContents