function bookmark(url,title){
  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
  window.external.AddFavorite(url,title);
  } else if (navigator.appName == "Netscape") {
    window.sidebar.addPanel(title,url,"");
  } else {
    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
  }
}

function sleep(milliseconds)
{
	var start = new Date().getTime();
	while ((new Date().getTime() - start) < milliseconds)
    {
		// Do nothing
	}
}

function strpos (haystack, needle, offset) 
{
    var i = (haystack+'').indexOf(needle, (offset ? offset : 0));
    return i === -1 ? false : i;
}
function replaceAll( str, from, to ) {
    var idx = str.indexOf( from );
 
 
    while ( idx > -1 ) {
        str = str.replace( from, to );
        idx = str.indexOf( from, idx+1 );
    }
 
    return str;
}
function addElement() 
{
	var ni = document.getElementById('checkform_div');
	var newdiv = document.createElement('div');
	var divIdName = 'sdiv';
	newdiv.setAttribute('id',divIdName);
	ni.appendChild(newdiv);
	nodisplay=0;
}
function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}
function setCookie(c_name,value,expiredays)
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
function addSugestion(val)
{
	if(val.indexOf(' ') ==-1 && val.indexOf('%20') ==-1)
	{
		var oldcook = getCookie('ymsgrsg');
		if(strpos(oldcook,val,0)!==false)return;
		var cook = oldcook + '#sep#' + escape(val);
		setCookie('ymsgrsg',cook,30);
	}
}
function delSugestion(val)
{
	var oldcook = getCookie('ymsgrsg');
	val = '#sep#'+escape(val);
	var cook = oldcook.replace(val,"");
	setCookie('ymsgrsg',cook,30);
 
}
function searchSugestion(val)
{

}
function show()
{
	var sugestions = getCookie('ymsgrsg').split('#sep#');
	var str='<table><tr><td valign=top width=150>BuddiesList:</td><td><table>';
	for( var i = 0; i<sugestions.length;i++ )
	{
		if(sugestions[i]!='')
			
				str = str + "<tr><td><div style='padding-left:10px;padding-right:20px' onmouseover='this.style.background=\"#66FFFF\";this.style.cursor=\"pointer\"' onmouseout='this.style.background=\"\"' onclick='document.getElementById(\"aidi\").value=\"" + sugestions[i] + "\";check_all();'><b>" + sugestions[i]+ "</b></div></td><td><div onmouseover='this.style.background=\"#66FFFF\";this.style.cursor=\"pointer\"' onmouseout='this.style.background=\"\"' onclick='delSugestion(\"" + sugestions[i] + "\"); show();'> x </div></td></tr>";
	}	
	str=str+"</table></td></tr></table>";
	document.getElementById('sdiv').style.display='block';
	document.getElementById('sdiv').innerHTML = str;
	
}
function initMakeup()
{
	addElement();
	document.getElementById('form1').setAttribute("autocomplete", "off");
	document.getElementById('form1').onsubmit = function() 
		{
			if(document.getElementById('aidi').value!='enter yahoo id')addSugestion(document.getElementById('aidi').value);
			show();
			check_all();
			return false;
		}
	show();
	//document.getElementById('aidi').focus();
}

function check_all()
{
	showmethemoney2();
	showmethemoney0();
	showmethemoney1();
}
function showmethemoney0()
{
xmlHttp0=GetXmlHttpObject0();
if (xmlHttp0==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="tools/check.php";
idul=document.getElementById('aidi').value;
url=url+"?info=0&id="+idul;
xmlHttp0.onreadystatechange=stateChanged0;
xmlHttp0.open("GET",url,true);
xmlHttp0.send(null);
return false;
}
function showmethemoney1()
{
xmlHttp1=GetXmlHttpObject1();
if (xmlHttp1==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="tools/check.php";
idul=document.getElementById('aidi').value;
url=url+"?info=1&id="+idul;
xmlHttp1.onreadystatechange=stateChanged1;
xmlHttp1.open("GET",url,true);
xmlHttp1.send(null);
return false;
}
function showmethemoney2()
{
xmlHttp2=GetXmlHttpObject2();
if (xmlHttp2==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="tools/check.php";
idul=document.getElementById('aidi').value;
url=url+"?info=2&id="+idul;
xmlHttp2.onreadystatechange=stateChanged2;
xmlHttp2.open("GET",url,true);
xmlHttp2.send(null);
return false;
}
function GetXmlHttpObject0()
{
var xmlHttp0=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp0=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp0=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp0=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp0;
}
function GetXmlHttpObject1()
{
var xmlHttp1=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp1=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp1=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp1=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp1;
}
function GetXmlHttpObject2()
{
var xmlHttp2=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp2=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp2=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp2=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp2;
}
function stateChanged0() 
{ 
    if (xmlHttp0.readyState==1)
    {
		document.getElementById("info0").innerHTML = "<div align='center'><img src='template/images/loading.gif' width='30' alt='loading' /></div>";

		
    }
    if (xmlHttp0.readyState==4)
    {
        var yahoo_id = document.getElementById('aidi').value;
        var ret = xmlHttp0.responseText;
        ret = ret.split("#.#.#");
        
		document.getElementById("info0").innerHTML = ret[0];

		
    }

}
function stateChanged1() 
{ 
    if (xmlHttp1.readyState==1)
    {

        document.getElementById("info1").innerHTML = "<div align='center'>This may take a few seconds.<br><img src='template/images/loading.gif' width='30' alt='loading' /></div>";
		
    }
    if (xmlHttp1.readyState==4)
    {
        var yahoo_id = document.getElementById('aidi').value;
        var ret = xmlHttp1.responseText;
        ret = ret.split("#.#.#");
       
        document.getElementById("info1").innerHTML = ret[1];
		
    }

}
function stateChanged2() 
{ 
    if (xmlHttp2.readyState==1)
    {

		document.getElementById("info2").innerHTML = "<div align='center'><img src='template/images/loading.gif' width='30' alt='loading' /></div>";
		
    }
    if (xmlHttp2.readyState==4)
    {
        var yahoo_id = document.getElementById('aidi').value;
        var ret = xmlHttp2.responseText;
        ret = ret.split("#.#.#");
        
		document.getElementById("info2").innerHTML = ret[2];
		
    }

}
if(top.location!=window.location)top.location='http://www.jdetector.com';
