<?xml version="1.0" encoding="UTF-8" ?> 
<Module> 
<ModulePrefs
description="The Reverse Australia gadget lets you search for people by phone numbers and identify pesky telemarketers before answering their call. This is the fastest way to do reverse phone lookups right from your iGoogle homepage. Set your API key in preferences and get results without leaving Google."
author="ReverseAustralia.com"
author_affiliation="www.reverseaustralia.com"
author_email="admin@reverseaustralia.com"
author_photo="http://www.reverseaustralia.com/igoogle/logo3.png"
author_link="http://www.reverseaustralia.com"
width="320"
height="130"
screenshot="http://www.reverseaustralia.com/igoogle/screenshot.png"
thumbnail="http://www.reverseaustralia.com/igoogle/screenshot.png">
<Icon>http://www.reverseaustralia.com/favicon.ico</Icon>
</ModulePrefs> 
<UserPref name="apikey" display_name="API Key" default_value=""/>
<Content type="html"> 
<![CDATA[
<style>
a { color: #8BC0D2; }
a:hover { color: #5b9db3 }
input[type="text"]
{
    font-family: Arial, Sans-Serif;
    font-size: 18px;
    margin-bottom: 5px;
    padding: 4px;
    border: solid 1px #85b1de; 
    width: 120px;
    background-color: #EDF2F7;
}
input[type="submit"]
{
    width: 40px;
    color: #666;
    font-family: Arial, Sans-Serif;
    font-size: 18px;
    padding: 4px;
    margin-left: 2px;
    border: solid 1px #85b1de; 
    background-color: #EDF2F7;
}
input[type="submit"]:hover
{
    background-color: #e1ecf8;
    cursor: pointer;
}
</style>
<script type="text/javascript">
function checkForm(form)
{
	document.getElementById('searchresult').innerHTML = '';
	var prefs = new _IG_Prefs();
	var apikey = prefs.getString("apikey");
	if (apikey.length != 32) {
		return true;
	}
	var search = document.getElementById('searchbox').value;
	if (search == '') {
		return false;
	}
	_IG_FetchContent("http://api.reverseaustralia.com/cidlookup.php?format=text&key=" + escape(apikey) + "&q=" + escape(search) + "&spamscore=1&extended=0",
		function(data) {
			if (data != '') {
				if (data.indexOf('	') == -1) {
					alert(data);
				} else {
					var response = data.split('	');
					var name = response[0];
					var score = response[1];
					if (name == 'Not found' && score > 0) {
						name = 'Unknown';
					}
					var txt = name;
					if (score >= 30) {
						txt = '<font color="#ff0000">' + txt + '</font>';
					}
					if (name != 'Not found') {
						var link = 'http://www.reverseaustralia.com/lookup/' + search.replace(/[^0-9]/, '') + '/';
						txt = '<a target="_top" href="' + link + '">' + txt + '</a>';
					}
					document.getElementById('searchresult').innerHTML = txt;
				}
			}
			return;
		}
	);
	return false;
}
</script>
<center>
<div id="search" style="padding: 0px; padding: 0px;">
<table><tr><td style="background: url(http://www.reverseaustralia.com/igoogle/logo3.png) no-repeat; width: 75px; height: 90px;" valign="top">&nbsp;</td><td>
<form method="post" target="_top" action="http://www.reverseaustralia.com/search.php" onsubmit="return checkForm(this);"> 
<input type="text" name="search" id="searchbox" value="" autocomplete="off" />
<input type="submit" value="Go" /><br />
<div style="text-align: right; font-size: 12px; color:#666">ex. (02) 1234-5678</div>
<div style="text-align: center; margin-top: 5px; font-size: 20px;" id="searchresult"></div>
</form>
</td></tr></table>
</div>
</center>
]]>
</Content> 
</Module> 
