/*
 *
 *	jQuery Timer plugin v0.1
 *		Matt Schmidt [http://www.mattptr.net]
 *
 *	Licensed under the BSD License:
 *		http://mattptr.net/license/license.txt
 *
 */
 
 jQuery.timer = function (interval, callback)
 {

	var interval = interval || 100;

	if (!callback)
		return false;
	
	_timer = function (interval, callback) {
		this.stop = function () {
			clearInterval(self.id);
		};
		
		this.internalCallback = function () {
			callback(self);
		};
		
		this.reset = function (val) {
			if (self.id)
				clearInterval(self.id);
			
			var val = val || 100;
			this.id = setInterval(this.internalCallback, val);
		};
		
		this.interval = interval;
		this.id = setInterval(this.internalCallback, this.interval);
		
		var self = this;
	};
	
	return new _timer(interval, callback);
 };
 
 $(document).ready(function(){
    $.timer(3000, fadeText);
    
	function fadeText(){
		var tag = $("#buildTag");
		tag.fadeOut("fast", swapText);
		tag.fadeIn(); 
		//tag.slideUp("fast", swapText);
		//tag.slideDown(); 
	} 

	function swapText(){
		var tag = $("#buildTag");
        switch(tag.html()){  
            case "Community":  
                tag.html("Hope"); 
            break;  
            case "Hope": 
                tag.html("Expertise"); 
            break;  
            case "Expertise":  
                tag.html("Relationships");
            break; 
            case "Relationships":  
                tag.html("Trust");
            break; 
            case "Trust":  
                tag.html("Community");
            break; 
        }
	}  
});  
