// JavaScript Document
jQuery.noConflict();

jQuery(function(){
	jQuery('#verhaalform .row label').each(function(){
		var labelColor = '#999';
		var restingPosition = '5px';
	
		// style the label with JS for progressive enhancement
		jQuery(this).css({
			'color' : labelColor,
				'position' : 'absolute',
				'top' : '0px',
				'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 + 5 +'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);
			jQuery(this).fadeOut();
		} 
		jQuery(this).click(function() {jQuery(this).fadeOut();jQuery(this).next().focus();});   	
	
		// if the input is empty on focus move the label to the left
		// if it's empty on blur, move it back
		jQuery('#verhaalform input, #verhaalform textarea').focus(function(){
			var label = jQuery(this).prev('label');
			var width = jQuery(label).width();
			var adjust = width + 5 + 'px';
			var value = jQuery(this).val();
	
			if(value == ''){
				//label.stop().animate({ 'left':'-'+adjust }, 'fast');
				label.fadeOut();
			} //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');
				label.fadeIn();
			}
			//jQuery('#standardform #uid38').val(jQuery('#verhaalform #uid38').val());
			//jQuery('#standardform #uid83').val(jQuery('#verhaalform #uid83').val());
			var elements_with_specified_id = jQuery('[id=uid38]');
			var v38 = elements_with_specified_id[1];
			elements_with_specified_id = jQuery('[id=uid83]');
			var v83 = elements_with_specified_id[1];
			v38.value=jQuery('#verhaalform #uid38').val();
			v83.value=jQuery('#verhaalform #uid83').val();
//			v38.val(jQuery('#verhaalform #uid38').val());
//			v83.val(jQuery('#verhaalform #uid83').val());
		
		});
	});
}); // End loaded jQuery
