/* jQuery Pause by Jonathan Howard */
$.fn.pause = function(milli,type) {
	milli = milli || 1000;
	type = type || "fx";
	return this.queue(type,function(){
		var self = this;
		setTimeout(function(){
			$.dequeue(self);
		},milli);
	});
};

$.fn.clearQueue = $.fn.unpause = function(type) {
	return this.each(function(){
		type = type || "fx";
		if(this.queue && this.queue[type]) {
			this.queue[type].length = 0;
		}
	});
};
/***** FEATURE AREA ANIMATION ******/
$(document).ready(function(){
	$('.featureblock:gt(0)').hide();
	$('#slideshow').cycle({
		before: onBefore,
		after: onAfter,
    	fx:'fade',
		timeout: 5000,
		speed: 1000,
		pause: 1,
		pauseOnPagerHover: 1
	});
	function onBefore() {
		$('.featureblock').fadeOut(1).css('height','0');
	} 
	function onAfter(curr, next, opts) {               
    //CSS height is set to zero at the end of the fade so things don't look as choppy when loading in the new block.                  
        	var index = opts.currSlide;
            //Here is where the change-up of the feature text occurs. Fade-in the individual block that matches the index of the slide.
         $('.featureblock').eq(index).fadeIn(1);
         $('#projectlist > li:first').appendTo('#projectlist');
     }
});
$(document).ready(function(){
	$('.ezrotate').cycle({
    	fx:'fade',
		timeout: 10000,
		speed: 1000
	});
});
/*
		 * clearingInput: a jQuery plugin
		 *
		 * clearingInput is a simple jQuery plugin that provides example/label text
		 * inside text inputs that automatically clears when the input is focused.
		 * Common uses are for a hint/example, or as a label when space is limited.
		 *
		 * For usage and examples, visit:
		 * http://github.com/alexrabarts/jquery-clearinginput
		 *
		 * Licensed under the MIT:
		 * http://www.opensource.org/licenses/mit-license.php
		 *
		 * Copyright (c) 2008 Stateless Systems (http://statelesssystems.com)
		 *
		 * @author   Alex Rabarts (alexrabarts -at- gmail -dawt- com)
		 * @requires jQuery v1.2 or later
		 * @version  0.1.1
		 */
		
		(function ($) {
		  $.extend($.fn, {
			clearingInput: function (options) {
			  var defaults = {blurClass: 'blur'};
		
			  options = $.extend(defaults, options);
		
			  return this.each(function () {
				var input = $(this).addClass(options.blurClass);
				var form  = input.parents('form:first');
				var label, text;
		
				text = options.text || textFromLabel() || input.val();
		
				if (text) {
				  input.val(text);
		
				  input.blur(function () {
					if (input.val() === '') {
					  input.val(text).addClass(options.blurClass);
					}
				  }).focus(function () {
					if (input.val() === text) {
					  input.val('');
					}
					input.removeClass(options.blurClass);
				  });
		
				  form.submit(function() {
					if (input.hasClass(options.blurClass)) {
					  input.val('');
					}
				  });
		
				  input.blur();
				}
		
				function textFromLabel() {
				  label = form.find('label[for=' + input.attr('id') + ']');
				  // Position label off screen and use it for the input text
				  return label ? label.css({position: 'absolute', left: '-9999px'}).text() : '';
				}
			  });
			}
		  });
		})(jQuery);