/*
 * gearCaptcha - jQuery Plugin
 * 
 * Examples and documentation at: http://www.aeden.it
 * 
 * Copyright (c) 2011 Aeden.it - Daniele Cerioni
 * 
 * Version: 1.0.0(14/04/2011)
 * Requires: jQuery v1.3+
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
(function($){  
 $.fn.gearcaptcha = function(options) {
	 var defaults = {  
			 label:'please check for submit',
			 label_check:'enabled'
			  };
	 var options = $.extend(defaults, options);
	 return this.each(function() {  
    	var target=this;
    	formId=options.formId;
    	label=options.label;
    	if(!formId){formId=$(target).attr('id');};
    	if(options.plugged=='frontgears'){addon=" require='true' label='"+label+"'"}else{addon=''}
    	html="<input type='checkbox' name='gearcaptcha_tb' id='check_"+formId+"' "+addon+">";
    	html+="<label id='label_"+formId+"'>"+label+"</label>";
    	html+="<input type='hidden' id='gearcaptcha_"+formId+"' name='gearcaptcha' value='hash_"+formId+"'/>";
    	$(target).html(html);
    	$(target).find('#check_'+formId).click(function(){
    		$(target).find('#label_'+formId).html(options.label_check);
    		$(target).find('#gearcaptcha_'+formId).val('');
    		$(target).find('#check_'+formId).attr("disabled", true); 
    	});
    });  
 };  
})(jQuery);
