/**
 * etheon.net - etheon.js
 * @fileOverview etheon.net core JavaScript framework.
 * @description Collection of utility methods used throughout the site.
 * @version 0.1.0
 * @author etheon
 */

// Assert dependency on MooTools
if(typeof MooTools === "undefined") {
	throw "etheon.js requires the MooTools framework; let's try it again.";
}

/**
 * @namespace
 * @name etheon
 * @description Global etheon namespace; all things etheon go into it to avoid
 * cluttering the global namespace.
 */
var etheon = {
// ============================== PUBLIC PROPERTIES =============================
	VERSION: '0.1.0',
	log: new Notimoo(),
// =============================== UTILITY METHODS ==============================
 	/**
 	 * @memberOf etheon
 	 * @name etheon.getUniqueId
 	 * @function
 	 * @param {Integer} length The length of the id.
 	 * @returns {String} A unique DOM id. Default: 7
 	 */
	getUniqueId: function(length) {
		var id = "", i,
			chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,!;=-_";
			
		// Normalize length
		length = $pick(length, 7);
		
		// Loop until you find one; should yield on the first few times.
		do
		{
			for(i = 0; i < length; i++) {
				id += chars[Math.round(Math.random() * chars.length)];
			}
		} while($(id));
		
		return id;
	}
};