// addThis share button definitions
{
   
}

var default_search = "twitpic";

// define array for bird queue
var ToriQueue = new Array(0);
var currentQueueIndex = 0;

// Cloud Types: CSS name, Speed, Initial Speed
CloudTypes = new Array(3)
CloudTypes[0] = ["L", 35000, 8000];
CloudTypes[1] = ["M", 40000, 20000];
CloudTypes[2] = ["S", 45000, 30000];


$(document).ready(function(){

	// facebox for about tori's eye
	$('a[rel*=facebox]').facebox();
	
	// History
	function pageload(hash) {
/* 		hash = encodeURIComponent(hash); */
		if(hash) {
			fetchFeed('search.twitter.com/search', 'callback=?&rpp=40&', hash);
		} else {
			fetchFeed('search.twitter.com/search', 'callback=?&rpp=40&', default_search);
		}
	}

	$.historyInit(pageload);


	// Start the never-ending spawn cycle
	spawnTori();
	
	// Start the cloud movement
	for (i = 0; i < CloudTypes.length; ++ i) {
		moveCloud(CloudTypes[i][0], CloudTypes[i][1], CloudTypes[i][2]);
	}
	

});

// Cloud movement
function moveCloud(id, speed, initialspeed) {
	if (parseInt($("#cloud" + id).css("left")) == 100) {
		// Second or + movement, final speed
		$("#cloud" + id).css("left", "-220px");
		thisspeed = speed;
	} else {
		// First time it's moving, so start at initial speed
		thisspeed = initialspeed;
	}
		
	$("#cloud" + id).animate({left:"100%"}, thisspeed, "linear");
	setTimeout("moveCloud('" + id + "', "+speed+")", thisspeed+100);
}

/* define function to spawn tories */
function spawnTori(){
	if ((ToriQueue.length >= currentQueueIndex) && (ToriQueue[currentQueueIndex] != undefined)) {
		
	} 
	
	else {
		// Nothing good found in Queue, go to beginning
		currentQueueIndex = 0;
	}
	

}


function fetchFeed(type, parameters, torisQuery) {
}