var timer;
 
$(document).ready(function() {
	kevinrose();
	ijustine();
	poshy();
	ajv();
});

function kevinrose() {

	clearTimeout(timer);
	var results = '';
	var twitterer = 'Kevin';
	var theQuery = "stardefense+tinyurl+from%3Akevinrose";
 
	$.post("/getSearch.php", {query: theQuery},  function(xml){
		$('entry',xml).each(function(i){
			var title = $(this).find("title").text();
			//results = title + "<BR>";
			results = "<BR>";
		});
		if (results == '' || results == '<BR>') { $("#kevinrose-tweet").html("<div>playing stardefense iphone game, tried the challenge mode and defeated 25 waves - <a href='http://tinyurl.com/p836r7'>http://tinyurl.com/p836r7</a></div>"); }
		else { $("#kevinrose-tweet").html(results); }
	});
 
	timer = setTimeout('kevinrose()', 30000);
}

function ijustine() {

	clearTimeout(timer);
	var results = '';
	var twitterer = 'iJustine';
	var theQuery = "stardefense+tinyurl+from%3Aijustine";
 
	$.post("/getSearch.php", {query: theQuery},  function(xml){
		$('entry',xml).each(function(i){
			var title = $(this).find("title").text();
			//results = title + "<BR>";
			results = "<BR>";
		});
		if (results == '' || results == '<BR>') { $("#ijustine-tweet").html("<div>I just defeated 39 waves of S'rath invaders in #StarDefense Challenge Mode. Can you do better? <a href='http://tinyurl.com/orrhkp'>http://tinyurl.com/orrhkp</a></div>"); }
		else { $("#ijustine-tweet").html(results); }
	});
 
	timer = setTimeout('ijustine()', 30000);
}

function poshy() {

	clearTimeout(timer);
	var results = '';
	var twitterer = 'Poshy';
	var theQuery = "stardefense+tinyurl+from%3Aposhy";
 
	$.post("/getSearch.php", {query: theQuery},  function(xml){
		$('entry',xml).each(function(i){
			var title = $(this).find("title").text();
			//results = title + "<BR>";
			results = "<BR>";
		});
		if (results == '' || results == '<BR>') { $("#poshy-tweet").html("<div>I just defeated 39 waves of S'rath invaders in Star Defense Challenge Mode. Can you do better? <a href='http://tinyurl.com/nk9omq'>http://tinyurl.com/nk9omq</a></div>"); }
		else { $("#poshy-tweet").html(results); }
	});
 
	timer = setTimeout('poshy()', 30000);
}
 
function ajv() {

	clearTimeout(timer);
	var results = '';
	var twitterer = 'AJV';
	var theQuery = "stardefense+tinyurl+from%3Aajv";
 
	$.post("/getSearch.php", {query: theQuery},  function(xml){
		$('entry',xml).each(function(i){
			var title = $(this).find("title").text();
			//results = title + "<BR>";
			results = "<BR>";
		});
		if (results == '' || results == '<BR>') { $("#ajv-tweet").html("<div>I just defeated 43 waves of S'rath invaders in #StarDefense Challenge Mode. Can you do better? <a href='http://tinyurl.com/pdrshu'>http://tinyurl.com/pdrshu</a></div>"); }
		else { $("#ajv-tweet").html(results); }
	});
 
	timer = setTimeout('ajv()', 30000);
}