$(function(){
	$(".mFields").live('click',function(){			
		if($(this).val() == $(this).attr('title')){			
			$(this).val("");
		}
	});
	
	$('.mFields').blur(function(){
		if($(this).val() == ""){
			$(this).val($(this).attr('title'));
		}
	});
	
	$('form').live('submit', function(){
		var errors;
		var myElem;
		
		$(this).find('.required').each(function(){
			if(jQuery.trim($(this).val()).length < 2){
				$(this).addClass('error');
				errors = true;
				$('.errorContainer').show();
			}else{
				if($(this).attr('title') != $(this).val()){
					$(this).removeClass('error');
					
					if($(this).attr('type') == 'checkbox'){
						if(!$(this).is(':checked')){
							errors = true;
							$(this).addClass('error');
						}
					}
				}else{
					errors = true;
					$(this).addClass('error');
				}
				
				if(errors != true){
					errors = false;
					$('.errorContainer').hide();
				}else{
					errors = true;
					$('.errorContainer').show();
				}
			}
			
		});
		
		if(!errors){
			return true;
		}else{
			return false;
		}
		return false;
	});
});
