(function() {

	sbs.strings.queryString = function(pageUrl) {
		var url = pageUrl ? pageUrl : window.location.href;
		var strings = new Array();
		var mappings = new Object();
		
		function getMappings() {
			var index = url.indexOf('?');
			var i = 0;
			var endIndex, equalIndex;
			while (index != -1) {
				equalIndex = url.indexOf('=', index + 1);
				endIndex = url.indexOf('&', index + 1);
				
				var key = url.substring(index + 1, equalIndex);
				var value = decodeURI((endIndex == -1) ? url.substring(equalIndex + 1) : url.substring(equalIndex + 1, endIndex)).replace(/\+/g, ' ');
				index = endIndex;
				
				strings[i] = value;
				mappings[key] = i;
				i++;
			}
		}
		getMappings();
		
		this.getUrl = function() {
			return url;
		};
		this.getValueFromKey = function(key) {
			return (key in mappings) ? (strings[mappings[key]]) : null;
		};
		this.getValueFromIndex = function(index) {
			return (index >= 0 || index < strings.length) ? strings[index] : null;
		};
		this.getValue = function(item) {
			return (typeof(item) == 'number') ? this.getValueFromIndex(item) : this.getValueFromKey(item);
		};
		this.containsKey = function(key) {
			return key in mappings;
		};
	};
	
})();