/*
 * jQuery validate v0.1
 *
 * Copyright (c) 2009 Kiwi Creation
 * http://www.kiwicreation.ca/
 *
 * Author: David Arpin
 * Date: 2009-09-26
 */
 
(function($){  
	$.fn.validate = function(options) { 
		var settings = {
        	message: ''
        };
		
		$.extend(settings, options);
			
		return this.each(function() { 
			var form = $(this);
			
			form.submit(function() {
				var error = "";
				$(this).find(".required").each(function(){
					if(($(this).val() == "" || $(this).val() == $(this).attr("title")) || ($(this).attr("type") == "checkbox" && $(this).attr("checked") == false)) {
						$(this).css("border","1px solid #B5121B");
						error += "- " + $(this).attr("title") + "\n";
					}
				});
				if(error != "") {
					alert(settings.message + "\n" + error);
					return false;
				}
			});				
		});  
	};  
})(jQuery);