function onEnterField() {
   if (this.origLabel == null)
      this.origLabel = this.value;
   if (this.origLabel == null || this.origLabel == this.value)
      this.value = '';
		
	$(this).prev(".formError").slideUp();
}
function onLeaveField() {
   if (this.value == '' && this.origLabel != null)
      this.value = this.origLabel;
}
$(document).ready(function() {
	
   $('input[type=text], textarea').click(onEnterField);
	$('input[type=text], textarea').focus(onEnterField);
   $('input[type=text], textarea').blur(onLeaveField);
	
	$('.miniSurveyView').submit(function() {
		var formErrors = 0;
		$('input[type=text], textarea', this).each(function() {
			if ($(this).attr('origLabel') == undefined || $(this).val() == $(this).attr('origLabel')) {
				formErrors++;
				$(this).before('<div class="formError" id="formError'+formErrors+'" style="color:red;display:none;">Bitte Wert eingeben:</div>')
				$("#formError" + formErrors).slideDown(200,function() {					
				});
			}
		})
		if (formErrors > 0)
			return false;
		else
			return true;
	})
	 
});
