
/*
       Default Text Textbox
               Used to clear default text in an input field when clicked and replace with default when blurred on blank

       Author: Atticus White
               - contact@atticuswhite.com
                       - www.atticuswhite.com
*/
(function($){
       jQuery.fn.defaultText = function(){
               this.each(function(i,item){
                       var initial = $(item).val();
                       $(item).focus(function(){
                               if ($(item).val() == initial){
                                       $(item).val('');
                               }
                       });
                       $(item).blur(function(){
                               if ($(item).val() == ''){
                                       $(item).val(initial);
                               }
                       });
               });
       };
})(jQuery);



/* 
	Transition Controller
		Created to handle the transition effects of the case studies
	
	Author: Atticus White 
	        - contact@atticuswhite.com
			- www.atticuswhite.com
*/

/*
var vars = null;
(function($){
	
	var globals = {
		elements : new Array(),
		bubbles: new Array(),
		clickLock: false,
		timerLock:false,
		mutexLock:false,
		index: 0,
		speeds: {
			'fast':   2500,
			'medium': 3500,
			'slow':   4500
		}
	};
	var settings = {
		speed: 'medium',
		fadeSpeed: 800,
		lockTimeout: 2000
	};
	
	var methods = {
		init: function(element){
			element.each(function(i,item){
				if (i==0){
					$(item).css('display', 'inline-block');
					$(item).css('opacity', 1);
				} else {
					$(item).css('opacity', 0);
				}
				methods.buildBubble(i);
				globals.elements.push(item);
				events.bindHover();
			});
		},
		buildBubble: function(index){
			var bubble = $("<span id='case-study-bubble"+index+"' data-index='"+index+"' class='case-study-bubble'>O</span>");
			if (index==0)
				$(bubble).css('color', 'red');
			$("#bubble-container").append(bubble);
			$(bubble).click(function(){
				events.click(this);
			});
			globals.bubbles.push(bubble);
		},
		trans: function(_i){
			if (_i){
				methods.doTrans(_i);
			} else {
				setTimeout(function(){
					methods.doTrans();
				},globals.speeds[settings.speed]);
			}
		},
		
		doTrans: function(_i){
			if ( !globals.mutexLock && ( (!globals.clickLock) || _i )){
				globals.mutexLock = true;
				var i = globals.index;
				var item = globals.elements[i];
				var bubble = globals.bubbles[i];
				$(item).animate({opacity:0}, settings.fadeSpeed, function(){
					$(bubble).css('color', 'black');
					$(item).hide();
					_i ? i = _i : i = parseInt(globals.index)+1;
					if (i>=globals.elements.length)
						i=0;
					item = globals.elements[i];
					bubble = globals.bubbles[i];
					$(bubble).css('color', 'red');
					$(item).css('display', 'inline-block');
					$(item).animate({opacity:1}, settings.fadeSpeed);
					globals.index = i;
					globals.mutexLock = false;
					vars = globals;
					methods.trans();
				});
			} else {
				methods.trans();
			}
		},
		
		show: function(index){
			methods.trans(index);
		}
	};
	
	var events = {
		hover: function(){
			globals.clickLock = true;
		},
		hoverOut: function(){
			setTimeout(function(){
				globals.clickLock = false;
			}, globals.lockTimeout);
		},
		click: function(bubble){
			globals.clickLock = true;
			var index = $(bubble).attr('data-index');
			methods.show(index);
		},
		bindHover: function(){
			$(".case-study-container").hover(function(){
				events.hover();
			}, function(){
				events.hoverOut();
			});
		}
	}

	jQuery.fn.transitionTestimonials = function(options){
		if (options)
			$.extend(settings, options);
		methods.init(this);
		console.log(globals);
		methods.trans();
		
	};
})(jQuery);
*/


