$(document).ready(function()
{
	$("#class").autocomplete(classes,{
		matchContains: true,
		formatItem: function(row, i, max, value) {
	  		  return ucwords(row.name);
	  	},
	  	formatMatch: function(row, i, max, value) {
	  		return row.name;
	  	},
		formatResult: function(row) {
		  return ucwords(row.name);
		}

	});
	
	$("#place").autocomplete(places,{
		matchContains: true,
		formatItem: function(row, i, max, value) {
	  		  return ucwords(row.name);
	  	},
	  	formatMatch: function(row, i, max, value) {
	  		return row.name;
	  	},
		formatResult: function(row) {
		  return ucwords(row.name);
		}

	});

});

function ucwords(str) {
    return (str+"").replace(/^(.)|\s(.)/g, function ( $1 ) { return $1.toUpperCase( ); } );
}