// Linkfunction
// Make an element linkable, with the first link nested inside the element

(function($){
	$.fn.linkelement = function(options) {

		var defaults = {
	    		className: "linkedelement"
   		};
	
   		var options = $.extend(defaults, options); 

		return this.each(function() {
			
			elm = $(this);
  			var link = elm.children().find("a[href]").attr("href");
  			if(link) {
	  			//elm.css({border:"1px solid yellow"});
  				elm.wrap("<a href='"+link+"' style='cursor: pointer;' class='"+options.className+"'></a>");
  			}
		});  

	};
})(jQuery);