(function($){
	$.fn.qtooltip = function(options) {
		if(!options) {
			options = {};
		}
		
        // support multiple elements
        if (this.length > 1){
            this.each(function() { $(this).qtooltip(options); });
            return this;
        }
        
        if($(this).html()) {
	        var parent = $(this).parent();
	        options.content = $(this).html().replace(/"/g, '&qout;');
	        
	        if($(this).hasClass("important")){
	        	$(this).replaceWith('<img class="qtooltip-question" src="/site_images/icon_exclamation_mark.png">');
	        } else {
	        	$(this).replaceWith('<img class="qtooltip-question" src="/site_images/icon_question_mark.png">');
	        }
	        $(".qtooltip-question", parent).qtip(options);
        }
	};
	
	$.qtipHideAll = function() {
		$(".qtip").each(function() {
			$(this).qtip("destroy");
		});
	};
	
})(jQuery);

