(function($) {
    $.fn.clickable = function() {
        $(this).css("cursor","pointer").click( 
            function() {
                var href = $(this).find("a").attr("href");
                var new_window = $(this).find("a").attr('target') === '_blank';

                new_window ? window.open(href) : (window.location = href);
                return false;
            }
        );
    };
	
	$.fn.clearForm = function () {
		$(this).click(function () {
			$(this).parents('form').find(':input').not(':button, :submit, :reset, :hidden')
			.val('')
			.removeAttr('checked')
			.removeAttr('selected');
		});
	};

    $( function ($) {
        $(".js-clickable").clickable();
		$("[rel='js-clear']").clearForm();
    });
})(jQuery);

