
(function($){
  $.fn.mobilSumma = function(options) {
  
  var opts = $.extend({}, $.fn.mobilSumma.defaults, options);
  
  domobilSumma = function(obj) {
    if (obj.attr("href")) {
      var e = obj.attr("href");  
      e = e.replace(opts.replace, opts.replaceWith); 
      obj.attr("href", e);
    }
  };
  
  return $(this).each(function() {
    if (screen.availWidth <= 500) {
      domobilSumma($(this));
    }
  });
};
// plugin defaults - added as a property on our plugin function
$.fn.mobilSumma.defaults = {
    replace: ".dk/summa",
    replaceWith: ".dk/mobilsumma"
};
})(jQuery);

