var countinglinks = {  
	
	divs : {},

	writelinkscount : function(url)
	{
		var divid = "id"+new Date().getUTCMilliseconds();
		document.write('<span id="'+divid+'">-</span>');
		eval("countinglinks."+divid+" = function(obj) { test('"+divid+"',obj); };");
		setTimeout("dystRequest('http://search.yahooapis.com/SiteExplorerService/V1/inlinkData','results=1&appid=TVqEycHV34Fup3DgOGwLBtC2dQirTPXFO6W2bcy0z9iJbY0ZuBNlckOAFpudHoHiBh3.LTo-&entire_site=0&omit_inlinks=1&output=json&callback=countinglinks."+divid+"&query="+url+"');",500);

		//setTimeout("dystRequest('http://countinglinks.com/api/yahooproxyjs.php','url="+url+"&divid="+divid+"')",500);
	},
	
	gotolinkspage : function(url)
	{
		window.location = "http://siteexplorer.search.yahoo.com/advsearch?bwm=i&bwmo=d&bwmf=u&p=http%3A%2F%2F"+url;
	},
	
	openlinkswindow : function(url)
	{
		window.open("http://siteexplorer.search.yahoo.com/advsearch?bwm=i&bwmo=d&bwmf=u&p=http%3A%2F%2F"+url);		
	},

	gotohomepage : function(url)
	{
		window.location = "http://countinglinks.com/";
	},
	
	openhomewindow : function(url)
	{
		window.open("http://countinglinks.com/");		
	}
	
};

function test(divid, results)
{
	document.getElementById(divid).innerHTML = results.ResultSet.totalResultsAvailable;
}
function dystRequest(url,params)
{
	var dyst = document.createElement("script");
	dyst.type = "text/javascript";
	if (params) 
	{ 
		dyst.src += url+"?"+params;
	}
	else 
	{ 
		dyst.src = url;
	}
	document.body.appendChild(dyst);
}