function getElementsByClass(tagName, className) {
	return $(tagName + "." + className);
}

function getFormattedUrl(str) {
	str = str.replace(' ', '-');
	str = str.toLowerCase();
	return str;
}

var userConfig;

var QuadrigaCars = {
	selectedEcoCarType: '0',
	selectedEcoCarTitle: '',
	selectedEcoCarIds: [],
	selectedEcoCarName: '',
	userSavedConfig: false
}

function hideCarBackground() {
	if (QuadrigaCars.startMode === 'club-cars' || QuadrigaCars.startMode === 'eco-cars') {
		$('.supersize')[0].style.background = 'none';
	} else {
		$('.supersize')[0].style.background = '#f0f0f0';
	}
}

if (!Array.prototype.each) {
	/**
	 * Executes the specified function once for every item in the array, passing each
	 * item as the first, index as second and array length as third parameter. 
	 * Returning false from the function will stop the iteration.
	 * @param {Function} fn The function to execute for each item.
	 * @param {Object} scope (optional) The scope in which to execute the function.
	 */
	Array.prototype.each = function(fn, scope) {
		var items = [].concat(this); // each safe for removal
		for(var i = 0, len = items.length; i < len; i++){
			if(fn.call(scope || items[i], items[i], i, len) === false){
				break
			}
		}
	}
}

function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}