function formValidate() {
	err 		= new Array();
	formError 	= false;
	$('#data .required').each(
		function(i) {
			// store title
			if($(this).attr('title') != undefined && $(this).attr('title') != "" ) fTitle = $(this).attr('title');
			else fTitle = "";

			if($(this).val() == "" || $(this).val() == null || $(this).val() == fTitle) {
				var fKey = '#' + String(this.id).replace("[]","");

				$('label[for="'+fKey+'"]').removeClass();
				$('label[for="'+fKey+'"]').addClass('error');
	
				$(this).removeClass();
				$(this).addClass('required error');

				// add blur check
				$(this).blur(function() {
					var fKey = String(this.id).replace("[]","");
					if($(this).val() != "" && $(this).val() != null ) {
						$('label[for="'+fKey+'"]').removeClass();
						$(this).removeClass();
						$(this).addClass('required');

						if($(this).attr('rel') != undefined && $(this).attr('rel') != "" ) {
							sKey = '#' + (String($(this).attr('rel')).replace(" ","_").toLowerCase());
							$(sKey).css("textDecoration","line-through");
						}					
						else if($(this).attr('title') != undefined && $(this).attr('title') != "" ) {
							sKey = '#' + (String($(this).attr('title')).replace(" ","_").toLowerCase());
							$(sKey).css("textDecoration","line-through");
						}
						
					} else {
						var dVal = $(this).attr('title');
						var eVal = $(this).val();
						if($(this).attr('rel') != undefined && $(this).attr('rel') != "" ) {
							$(this).val(dVal);
							$(this).css("color", "#6e6356");
							
							sKey = '#' + (String($(this).attr('rel')).replace(" ","_").toLowerCase());
							$(sKey).css("textDecoration","none");					
						}
						else if($(this).attr('title') != undefined && $(this).attr('title') != "" ) {
							$(this).val(dVal);
							$(this).css("color", "#6e6356");
							
							sKey = '#' + (String($(this).attr('title')).replace(" ","_").toLowerCase());
							$(sKey).css("textDecoration","none");					
						}
						
						$('label[for="'+fKey+'"]').removeClass();
						$('label[for="'+fKey+'"]').addClass('error');
	
						$(this).removeClass();
						$(this).addClass('required error');
					}
				});

				err[err.length] = $(this);
				formError = true;
			
			} else {
				var fKey = String(this.id).replace("[]","");		
				$('label[for="'+fKey+'"]').removeClass();
				
				$(this).removeClass();
				$(this).addClass('required');
			}
		}
	);
	
	// reset other fields so defaults don't get passed along
	$('#data input:not(.required)').each(
		function(i) {
			// store title
			if($(this).attr('title') != undefined && $(this).attr('title') != "" ) fTitle = $(this).attr('title');
			else fTitle = "";
			
			if($(this).val() != "" && $(this).val() != null && $(this).val() == fTitle) {
				var fKey = String(this.id).replace("[]","");		
				$('label[for="'+fKey+'"]').removeClass();
				
				$(this).removeClass();
				$(this).val("");
			}
		}
	);	
	// handles any errors
	if(formError == true) {
		display_error(err);
		$('#fStatus').val(0);
			
	} else {
		$('#fStatus').val(1);
		$('#data').submit();
	}
}

// create hooks
$(window).load(function () { 
	$('#data .required').each(
		function(i){
			hookFormCheck( this.id );
		}
	);
});	
