var link;
var action;

function drawSearchForm(){
	if(action != undefined)
		formhtml='<form style="margin:0" name="whoami" method="POST"  action="'+action+'">';
	else
		formhtml='<form style="margin:0" name="whoami" method="POST"  action="http://www.poker-edge.com/whoami.'+link+'">';

	formhtml=formhtml+'<table style="margin:0">'+
	'<tr><td>'+
	'<font STYLE="font-size:9px; font-family:verdana;"><strong><center>1 Million Online Players Tracked - View YOUR Stats:</center></strong></font>'+
	'</td></tr>'+
	'<tr><td>'+
	'<table width="290" height="60"  border="0" align="center" cellpadding="0" cellspacing="0">'+
	'<tr>'+
	'<td width="290" height="50" style="BACKGROUND: url(http://www.poker-edge.com/index_files/lookup.jpg) #83bde3 no-repeat left top; border-color:#000000; border-width:1px; border-style:solid;">'+
	'<table width="290" height="50"  border="0" align="center" cellspacing="0">'+
	'  <tr>'+
	'    <td style="padding-top:8px; padding-left:15px;">'+
	'<input name="name" type="text" id="name" size="18" maxlength="40" style="width: 125px; height: 19px; background-color: #FFFFFF; font-size:10px; font-family:verdana; vertical-align:top">'+
	'<input type="image" src="http://www.poker-edge.com/index_files/whoamisearch.png" border="0" style="vertical-align: top">'+
	'</td>'+
	'    </tr>'+
	'</table></td>'+
	'</tr>'+
	'</table>'+
	'</td></tr>'+
	'<tr><td>'+
	'<font STYLE="font-size:9px; font-family:verdana;"><strong><center>Powered by <a target="_blank" href="http://www.poker-edge.com/">Poker-Edge.Com</a> | Get This on <a target="_blank" href="http://www.poker-edge.com/getwhoami.html">YOUR Website</a></center></strong></font>'+
	'</td></tr>'+
	'</table>'+
	'</form>'+
	'<div id="results" name="results"></div>';
	
	document.getElementById('whoamiform').innerHTML=formhtml;

}

function showResults(){
	name = document.getElementById('name').value;
	site = document.getElementById('site').value;
	url = 'http://www.poker-edge.com/whoami.php?name='+name+'&site='+site+'&raw=1&date=' + escape(Date());
	loadXMLDoc(url);
	return false;
}

function loadXMLDoc(url)
{
	// branch for native XMLHttpRequest object
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
		req.onreadystatechange = processReqChange;
		req.open("GET", url, true);
		req.send(null);
		// branch for IE/Windows ActiveX version
	} else if (window.ActiveXObject) {
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if (req) {
			req.onreadystatechange = processReqChange;
			req.open("GET", url, true);
			req.send();
		}
	}
}



function processReqChange()
{
	// only if req shows "complete"
	if (req.readyState == 4) {
		// only if "OK"
		if (req.status == 200) {
			// ...processing statements go here...
			html = req.responseText;
			document.getElementById('results').innerHTML=html;
		} 
		else {
			//alert("There was a problem retrieving the XML data:\n" + req.statusText);
		}
	}
}