var Rain = (function() {
	var Rain = function() {
		/* Silence is golden. */
	};
	
	Rain.config = {
		baseWeb: 'http://www.xlnaudio.com',
		siteUrl: 'http://www.xlnaudio.com/sites/default',
		params: []
	};
	
	var modules = {
		callable: {},
		auto: []
	};
	
	Rain.parseUrl = function() {
		var baseWeb = Rain.config.baseWeb, params;
		if (baseWeb === (window.location.protocol + '//' + window.location.host)) {
			params = window.location.pathname.split('/');
			params.shift();
			if (params[0] === '') {
				params[0] = 'index';
			}
			Rain.config.params = params;
		}
	};
	
	Rain.define = function() {
		var a = arguments;
		if (typeof a[0] === 'string' && typeof a[1] === 'function') {
			modules.callable[a[0]] = a[1];
			if (a[2] === true) {
				modules.auto.push(a[1]);
			}
		} else if (typeof a[0] === 'function') {
			modules.auto.push(a[0]);
		}
	};
	
	Rain.run = function() {
		var a = arguments;
		if (typeof modules.callable[a[0]] !== 'undefined') {
			return modules.callable[a[0]](a[1]);
		}
	};
	
	Rain.init = function() {
		Rain.parseUrl();
		for (var i = 0; i < modules.auto.length; i++) {
			modules.auto[i]();
		}
	};
	
	return Rain;
})();

