$().ready(function() {
$.fn.randomClass=function(classes,settings){
		var defaults = {
			randomness: 'default',
			removeClasses: false
		};
		var s = $.extend(defaults, settings);
		
		if (s.randomness == 'pattern'){
			classes = shuffle(classes);
		}
		
		var p = -1;
		var cnt = 0;
		
		this.each( function() {
			if (s.removeClasses){
				for (c in classes){
					var cn = classes[c];
					if ( $(this).hasClass(cn) ){
						$(this).removeClass(cn);
					}
				}
			}
			if (s.randomness == 'pattern'){
				cnt++;
				$(this).addClass(classes[cnt%classes.length]);
			} else {
				do {
					var r = Math.floor(Math.random() * classes.length);
				} while (p == r && s.randomness == 'successive');
				
				$(this).addClass(classes[r]);
				p = r;
			}
		});
		
		shuffle = function(o){
			for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
			return o;
		};
		
		return this;
	};
	
	
	/* Sets a random back ground image on the feature div */
	$("#featured-projects").randomClass( 
    	[ 'blue', 'red', 'green' ],
    	{
         randomness: 'default',
       	 removeClasses: false
    	}
	);
	// Add animation to the background image so that it scrolls from right to left 
	//$('#featured-projects').animate({"background-position": "-6999px 0px"},555000,'linear');
	$(".tweet").tweet({
                join_text: "auto",
                avatar_size: 0,
                count: 2,
                auto_join_text_default: "We are Tweeting about...,",
                auto_join_text_ed: "we",
                auto_join_text_ing: "we were",
                auto_join_text_reply: "we replied to",
                auto_join_text_url: "we were checking out",
                loading_text: "loading tweets..."
            });
});
