// JavaScript Document
function hideTxt (currElement, nextElement, opts, isForward) {
	var i = currElement.id.replace ('m', '');
	i = parseInt (i);
	var classToHide = '.msg' + i;
	$(classToHide).hide();
}
function displayTxt (currElement, nextElement, opts, isForward) {
	var currID = '#' + currElement.id;
	var currClass = '.' + nextElement.id.replace ('m', 'msg');
	$(currClass).each (function (i) {
		$(this).attr('z-index', 500 + i);
		if (i == 0) {
			$(this).fadeIn (500);
		} else if (i == 1) {
			theID = '#' + this.id;
			setTimeout ('$("' + theID + '").fadeIn (1000)', 3000);
		} else if (i == 2) {
			theID = '#' + this.id;
			setTimeout ('$("' + theID + '").fadeIn (1000)', 5000);
		}		
	});
	
}
$(document).ready (function () {
	$('.messages').cycle ({
		fx: 'fade',
		autostop: 1,
		autostopCount: 8,
		timeout: 10000,
		after: displayTxt,
		before: hideTxt
	});
	new TWTR.Widget({
	  id: 'twitterFeed',
	  version: 2,
	  type: 'profile',
	  rpp: 3,
	  interval: 6000,
	  width: 200,
	  height: 130,
	  theme: {
		shell: {
		  background: '#ffffff',
		  color: '#666666'
		},
		tweets: {
		  background: '#ffffff',
		  color: '#949494',
		  links: '#0081c2'
		}
	  },
	  features: {
		scrollbar: true,
		loop: false,
		live: false,
		hashtags: true,
		timestamp: true,
		avatars: false,
		behavior: 'all'
	  }
	}).render().setUser('In4Grants').start();	
});

