(function($){
	$.fn.hfeSet = function(name, value) {
		
        // support multiple elements
        if (this.length > 1){
            this.each(function() {
            		$(this).hfSet(name, value); }
            );
            return this;
        }
        
        if($("INPUT[name='"+name+"']", $(this)).size() > 0) {
        	// element exists, set it
        	$("INPUT[name='"+name+"']", $(this)).attr('value', value);
        } else {
        	// element does not exsits, create with specified name and value
        	$(this).append('<input type="hidden" name="'+name+'" value="'+value+'">');
        }
        
        return this;
	};

	$.fn.hfeGet = function(name) {
		// in case of multiple elements, return the first one only
		if (this.length > 1){
            var getFrom = this[0];
        } else {
        	var getFrom = this;
        }
        
        return $("INPUT[name='"+name+"']", $(this)).attr('value');
	};
	
	$.fn.hfeUnset = function(name) {
		
        // support multiple elements
        if (this.length > 1){
            this.each(function() {
            		$(this).hfeUnset(name, value); }
            );
            return this;
        }
        
        $("INPUT[name='"+name+"']", $(this)).replaceWith('');
        
        return this;
	};
})(jQuery);

