//when the dom is ready...
window.addEvent('domready',function() {
	//a few settings
	var labelColor = '#000', restingPosition = 5;
	//for every form field
	$$('form#info .slider label').each(function(label){
		//set the label enhancements into place
		label.setStyles({
			color: labelColor,
			position: 'absolute',
			top: 6,
			left: restingPosition,
			display: 'inline',
			'z-index': 99
		});
		//get input value
		var input = label.getNext();
		//grab label width, add resting position value
		input.setAttribute('width','300');
		var width = label.getSize().x;
		var move = width + restingPosition;
		//onload, check if a field is filled out, if so, move the label out of the way
		if(input.get('value') !== '') {
			label.tween('left',width - move);
			label.style.color = '#999';
		}
		// if the input is empty on focus move the label to the left
		// if it's empty on blur, move it back
		input.addEvents({
			focus: function() {
				if(input.get('value') == '') {
					label.tween('left',0 - (width+10));
					label.style.color = '#999';
				}
				else {
					label.setStyle('left',0 - (width+10));
					label.style.color = '#999';
				}
			},
			blur: function() {
				if(input.get('value') == ''){
					label.tween('left',restingPosition);
					label.style.color = '#000';
				}
			}
		});
	});
});
