
// add parser through the tablesorter addParser method 
$.tablesorter.addParser({ 
	// set a unique id 
	id: 'NUM', 
	is: function(s) { 
		// return false so this parser is not auto detected 
		return false; 
	}, 
	format: function(s) { 
		// format your data for normalization
		x = s.toLowerCase().replace("chf","").replace("gb","").replace("mb","").replace("*","").replace("unlimitiert", 10000000);
		
		return x ; 
	}, 
	// set type, either numeric or text 
	type: 'numeric' 
}); 

/*

$.tablesorter.addWidget({
  // give the widget an id
  id: "sortPersist",
  // format is called when the on init and when a sorting has finished
  format: function(table) {

	// Cookie info
	var cookieName = 'MY_SORT_COOKIE';
	var cookie = $.cookie(cookieName);
	var options = {path: '/'};

	var data = {};
	var sortList = table.config.sortList;
	var tableId = $(table).attr('id');
	var cookieExists = (typeof(cookie) != "undefined" && cookie != null);

	// If the existing sortList isn't empty, set it into the cookie and get out
	if (sortList.length > 0) {
	  if (cookieExists) {
		data = $.evalJSON(cookie);
	  }
	  data[tableId] = sortList;
	  $.cookie(cookieName, $.toJSON(data), options);
	}

	// Otherwise...
	else {
	  if (cookieExists) { 

		// Get the cookie data
		var data = $.evalJSON($.cookie(cookieName));

		// If it exists
		if (typeof(data[tableId]) != "undefined" && data[tableId] != null) {

		  // Get the list
		  sortList = data[tableId];

		  // And finally, if the list is NOT empty, trigger the sort with the new list
		  if (sortList.length > 0) {
			$(table).trigger("sorton", [sortList]);
		  }
		}
	  }
	}
  }
});
  

*/



$(document).ready(function() {
	
    $("#Angebote").tablesorter({
			widgets: ['sortPersist'],
			sortList: [[0,0],[1,0]],
            headers: { 
				2: { 
                    sorter:'NUM' 
                },
				3: { 
                    sorter:'NUM' 
                },
				4: { 
                    sorter:'NUM' 
                },
				5: { 
                    sorter:'NUM' 
                },
				7: { 
                    sorter:'NUM' 
                }
				
				
            } 
        }); 
}); 