var myTasks=new Array(5);
myTasks[0]="My mac crashed!!!";
myTasks[1]="My internet is slow!!!";
myTasks[2]="I can't send email!!!";
myTasks[3]="Why can't I print?!";
myTasks[4]="Where's my WIFI???";

$(document).ready(function(){
	//kick things off
	switchTask(0);
});

function switchTask(last_index) {
	//randomly grab something from the array based on key
	var index = Math.floor((4-0)*Math.random());
	
	//make sure we don't play the same text over because that looks lame
	if(index == last_index) {
		if(index == 4) {
			index = 0;
		} else {
			index++;
		}
	}
	
	//load that html into the div
	$('#txt_widget').html(myTasks[index]);

	//show the div
	$('#txt_widget').show();
	
	//slide it across
	//you could add the easing lib, and give this some real flavor
	$('#txt_widget').animate({left:"10px"}, {duration: 2500, easing: 'easeInOutExpo',queue:"first",scope:"global"});
	
	//fade it away or something here
	$("#txt_widget").fadeOut({speed: 500,queue:"first",scope:"global",preDelay:4500});
	
	//no that it's hidden quick bring it back to the start position
	$('#txt_widget').animate({left: "878px"},{duration: 100,queue:"first",scope:"global",preDelay:5005});
	
	//easing
	//$('#txt_widget').animate({left:"10px"}, {duration: 4000, easing: 'easeInOutExpo'});

	//rinse and repeat in in about 5 seconds
	setTimeout('switchTask('+index+')',5200); //set in milliseconds
	
}
