/* Tools */
(function(){
	var instance = null;
	function _Tools(){};
	
	_Tools.prototype = {
		/* Stop action/propagation d'un evenement */
		/* @argument - (Obj) evt : evenement */
		/* @return - (Obj) evt : evenement */
		stopEvent: function(evt){
			if(window.event){ //IE
				evt = window.event;
				evt.returnValue = false;
			}
			try {
				evt.cancelBubble = true;
				if(evt.preventDefault) evt.preventDefault();
				if(evt.stopPropagation) evt.stopPropagation();
				if(evt.stopped) evt.stopped = true;
			} catch(e) {
				/* console.log(e.message); */
			}		
			return evt;
		},
		
		/* Heritage Class */
		extendClass: function(childClass, parentClass){
			var F = function(){};
			F.prototype = parentClass.prototype;
			childClass.prototype = new F();
			childClass.prototype.constructor = parentClass;
			childClass.parentClass = parentClass.prototype;
			if(parentClass.prototype.constructor == Object.prototype.constructor){
				parentClass.prototype.constructor = parentClass;
			}
		}
	};
	
	/* Singleton - getInstance */
	var getInstance = function(){
		instance = (!instance)? new _Tools() : instance;
		return instance;		
	};
	
	window.hexagram = window.hexagram || {};
	window.hexagram.tools = window.hexagram.tools || getInstance();		
})();