/* CLIQUE */
/* Actions Pattern Javascript
----------------------------------------------------------------------------- */


	(function($) {
	
	$.fn.cliqueActions = function() {
	
	
/* PRESERVE CHAINING
----------------------------------------------------------------------------- */


		return this.each(function(index) {

			var $this = $(this);
	
/* REPLACE BUTTONS
----------------------------------------------------------------------------- */

			
			if ($this.attr('value') && $this.attr('value') != "Submit") {
			
				var language = $this.attr('value');
			
			} else if ($this.parent().parent().parent().hasClass('signin')) {
			
				var language = "Sign In";
				
			} else if ($this.parent().parent().parent().hasClass('password')) {
			
				var language = "Reset Password";
			
			} else {
			
				var language = "Submit";
			
			}
			
			$this.parent().addClass('submit');			
			$this.after('<a class="action submit" href="#submit">' + language + '</a>');
		

/* SUBMIT FORM
----------------------------------------------------------------------------- */
	
	
			$('a.action.submit').click(function() {
	
				$(this).siblings('input[type=submit]').click();

				// DISABLE SUBMIT ORDER BUTTON AFTER CLICK
				if ($(this).parent().hasClass('emphasis')) $(this).unbind('click').click(function() { return false; });
				
				return false;
				
			});
	
	
/* END PLUG-IN
----------------------------------------------------------------------------- */


		});
	};
	})(jQuery);
