var xmlHttp
var strURL

function confess()
{
document.getElementById("confess").innerHTML=
"<h3>April Fools!</h3>" + 
"<p>There is no such thing as a site flag.</p>"+
"<p>The best way to ensure optimal search engine ranking is to develop a high quality site that complies with the recommendations of the search engines.</p>"+
"<p>Good luck!</p>";
}

function sendRequest()
{
var url="fee.php?sid=" + Math.random() + "&url=" + strURL
xmlHttp=GetXmlHttpObject(stateChanged)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}

function computeFee(str)
{ 
if (str.length > 0)
{
strURL=str;
document.getElementById("confess").innerHTML="";
document.getElementById("fee").innerHTML="<p>Please wait while the site flag fee is being computed.  This process compares sponsored pricing data from all the major search engines and determines the value of the flags.  It takes approximately 5 seconds, although results vary based on current network traffic.</p>";
var t1=setTimeout("sendRequest()",5000)
var t2=setTimeout("confess()",10000)
}
else
{ 
document.getElementById("status").innerHTML="";
document.getElementById("confess").innerHTML="";
document.getElementById("fee").innerHTML="Please enter a URL"
} 
} 

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
document.getElementById("fee").innerHTML=
"<span onmouseover=\"confess()\">"+xmlHttp.responseText+"</span>"; 
document.getElementById("confess").innerHTML="<p><a href=\"#\" disabled onmouseover=\"confess()\" >Click here to begin the purchase process</a></p>";
} 
} 

function GetXmlHttpObject(handler)
{ 
var objXmlHttp=null

if (navigator.userAgent.indexOf("Opera")>=0)
{
alert("This example doesn't work in Opera") 
return 
}
if (navigator.userAgent.indexOf("MSIE")>=0)
{ 
var strName="Msxml2.XMLHTTP"
if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
{
strName="Microsoft.XMLHTTP"
} 
try
{ 
objXmlHttp=new ActiveXObject(strName)
objXmlHttp.onreadystatechange=handler 
return objXmlHttp
} 
catch(e)
{ 
alert("Error. Scripting for ActiveX might be disabled") 
return 
} 
} 
if (navigator.userAgent.indexOf("Mozilla")>=0)
{
objXmlHttp=new XMLHttpRequest()
objXmlHttp.onload=handler
objXmlHttp.onerror=handler 
return objXmlHttp
}
} 

