jQuery(function(){
	jQuery('.slider label').each(function(){
		var labelColor = '#999';
		var restingPosition = '8px';
		var distance = 3000;
		// style the label with JS for progressive enhancement
		jQuery(this).css({
				'color' : labelColor,
			 	'position' : 'absolute',
		 		'top' : '6px',
				'left' : restingPosition,
				'display' : 'inline',
	    		'z-index' : '99'
		});
	
		var inputval = jQuery(this).next().val();
		
		// grab the label width, then add 5 pixels to it
		var labelwidth = jQuery(this).width();
		var labelmove = labelwidth + distance +'px';
	
		// onload, check if a field is filled out, if so, move the label out of the way
		if(inputval !== ''){
			jQuery(this).stop().animate({ 'left':'-'+labelmove }, 1);
		}    	
		// if the input is empty on focus move the label to the left
		// if it's empty on blur, move it back
		jQuery('input, textarea').focus(function()
		{
			var label = jQuery(this).prev('label');
			var width = jQuery(label).width();
			var adjust = width + distance + 'px';
			var value = jQuery(this).val();
	
			if(value == '')
			{
				label.stop().animate({ 'left':'-'+adjust }, 'fast');
			} else {
				label.css({ 'left':'-'+adjust });
			}
		}).blur(function()
		{
			var label = jQuery(this).prev('label');
			var value = jQuery(this).val();
	
			if(value == '')
			{
				label.stop().animate({ 'left':restingPosition }, 'fast');
			}	
	
		});
	}); // End "each" statement
}); // End loaded jQuery
