// JavaScript Document



var hex = {
	 Version			: "1.2.0.7"
	,ID					: "hex"
	,RootPath			: "/library/hex/"
	,xConfigFile		: "hex.Config.js"
	,xCoreFolder		: "Core/"
	,xCoreCss			: "Core/css/"
	,xCoreImage			: "Core/Images/"
	,xCompFolder		: "Components/"
	,xSkinFolder		: "Skins/"
	,Skin				: "Default"
	,Skins				: {
		"Default"			: { Folder : "Default", CssFolder : "styles", ImagesFolder : "images"}
	}
	,CreateLog			: true
	,useDebugConsole	: true
	,Development		: true
	,useEventManager	: true
	,TagPreFix			: "hex"
	,Versions			: {
		Add		: function (strID,strVersion) {
			if (!this[strID]) {
				this[strID] = {
					 ID	: strID
					,Versions : strVersion
				}
				hex.Log.Add("Versions","[[" + strID + "]]: [$" + strVersion + "$]")
			}
		}
		
	}
	,Folders			: {
		 Core		: { root : "Core"		, styles : "styles"	, images : "Images"}
		,Components	: { root : "Components"	, styles : "styles"	, images : "Images"}
		,GetFullPath : function (strFolder,strType) {
			strType = (strType == null) ? "Components" : strType
			return this[strType].root + "/" + ((strFolder != null && (this[strType][strFolder] != null)) ? this[strType][strFolder]  + "/" : "")
		}
	}
	
	,Core				: {
		 Config : {
			 ID 	: "Config"
			,Path 	: null
			,File	: "hex.Config.js"
		 }
		,Common : {
			 ID 	: "Common"
			,Path 	: "Core"
			,File	: "hex.Common.js"
		 }
		,EventManager : {
			 ID 	: "EventManager"
			,Path 	: "Core"
			,File	: "hex.EventManager.js"
		 }
		,Connect : {
			 ID		: "Connect"
			,Path 	: "Core"
			,File	: "hex.Connect.js"
		 }
		,Window : {
			 ID		: "Window"
			,Path 	: "Core"
			,File	: "hex.Window.js"
		 }
		,Parse : {
			 ID		: "Parse"
			,Path 	: "Core"
			,File	: "hex.Parse.js"
		 }
		 ,ShortCuts : {
			 ID		: "ShortCuts"
			,Path 	: "Core"
			,File	: "hex.ShortCuts.js"
		 }
		 /*,DebugConsole : {
			 ID		: "DebugConsole"
			,Path 	: "Core"
			,File		: "hex.DebugConsole.js"
		 }*/
	}
	
	,Server				: {
		 Language			: {
			 "asp"		: true
			,".Net"		: true
			,".Net2"	: true
			,"php"		: false
		}
		,Components	: {
			 asp				: {}
			,php				: {}
			,Net				: {}
			,Net2				: {}
		}
		,getLanguage 	: function () {
			for (var objLang in this.Language) {
				if (this.Language[objLang]) {
					return objLang
					break;
				}
			}
			return null
		}
		
		
	}
	,$					: function(strID) {
		var objElement = document.getElementById(strID)
		//var objElement = new hex.DomElement
		if (objElement != null) {
			objElement.Text = function (strValue) {
				this.innerHTML = strValue
			}
		}
		return (objElement != null) ? objElement : null;
	 }
	,$$					: function (strElement, objAttributes) {
		if (objAttributes) {
			var objElement = (strElement != null || (strElement != "")) ? document.createElement(strElement) : null;
			for (var objAtt in objAttributes) {
				if (typeof objAttributes[objAtt] == "object") {
					for (var objSubAtt in objAttributes[objAtt]) {
						objElement[objAtt][objSubAtt] = objAttributes[objAtt][objSubAtt]
					}
				}else{
					objElement[objAtt] = objAttributes[objAtt]
				}
			}
			return objElement
		}else{
			return (strElement != null || (strElement != "")) ? document.createElement(strElement) : null;
		}
	 }
	,$$$					: function (strTagName,objElement) {
		if (objElement == null) {objElement = document}
		return objElement.getElementsByTagName(strTagName)
	}
	,InsertIntoBody	: function (objElement,blnEnd) {
		if (document.body.hasChildNodes() && (blnEnd != true)) {
			document.body.insertBefore(objElement,document.body.childNodes[0])
		}else{
			document.body.appendChild(objElement)
		}
	}
	,getAttr				: function (objElement,strAttribute) {
		var strReturn = null
		if (objElement && (objElement != null)) {
			if (document.getAttribute) {
				strReturn = objElement.getAttribute(strAttribute)
			}else{
				if (objElement.attributes && (objElement.attributes.getNamedItem(strAttribute) != null)) {
					strReturn = objElement.attributes.getNamedItem(strAttribute).nodeValue
				}
			}
		}
		return strReturn 
	}
	,getRootPath	: function () {
		var objScripts = this.$$$("script",this.$$$("head")[0])
		var strPath = this.RootPath
		var strPagePath = window.location.toString()
		for (var i=0;i<objScripts.length;i++) {
			if (objScripts[i].src.toString().indexOf("hex.js")> 0) {
				var strTempRoot = objScripts[i].src.toString().replace("hex.js","");
				break;
			}
		}
		return strTempRoot		
		if (strTempRoot.indexOf("/") == 0) {
			strPath = strTempRoot
		}else{
			strPagePath = strPagePath.replace(/^(http||https):\/\/||/,"")
			if (strPagePath.indexOf("?") > 0) {
				strPagePath = strPagePath.replace(/\?.*/,"")
			}
			strPath = ""
			var arrPath = strPagePath.split("/")	
			var intLength = arrPath.length -1
			if (strTempRoot.indexOf(".") == 0) {
				var objMatches = strTempRoot.match(/\.\.\//gi)
				intLength -= objMatches.length
				strTempRoot = strTempRoot.replace(/\.\.\//gi,"")
			}
			for (var i=1;i<intLength;i++) {
				strPath += "/" + arrPath[i]
			}
			if (strTempRoot.indexOf("http") > -1 || strTempRoot.indexOf("https") > -1) {
				strTempRoot = strTempRoot.replace(/^(http||https):\/\/||/,"")
				strTempRoot = strTempRoot.replace(arrPath[0] ,"")
				strTempRoot = strTempRoot.replace(strPath+ "/","")
			}
			strPath += "/" + strTempRoot
			
		}
		
		return strPath
	}
	,Initialise			: function (blnNoWinOnload) {
		this.Versions.Add(this.ID,this.Version)
		if (blnNoWinOnload != false) {
			var objLoadFunc	= function() {
				hex.WindowEvent.loaded = true;
			}
			if (window.addEventListener) {
            	window.addEventListener("load", objLoadFunc, true);
       		}else if (window.attachEvent && window.attachEvent("onload", objLoadFunc)) {
				var blnEventAdded = true
        	}else{
				window.onload = objLoadFunc
			}
		}
		
		this.Log.AddLog("Core")
		this.Log.Add("Core","Getting tempory root path...")
		
		var strTempRoot = this.getRootPath()
		
		
		this.RootPath = strTempRoot
		this.Log.Add("Core","Tempory root path: [$" + strTempRoot + "$]")
		this.Component.Clear()
		this.Component.onLoaded = hex.CoreLoaded
		
		if (!this.useDebugConsole) {hex.Core.DebugConsole = null}
		for (var objCore in hex.Core) {
			if (hex.Core[objCore] != null) {
				this.Component.Add(hex.Core[objCore].ID,hex.Core[objCore].File,hex.Core[objCore].Path,"Core")
			}
		}
		this.Component.Load("Core",strTempRoot)
		if (this.useDebugConsole) {
			document.onerror = window.onerror = function(message, url, lineNumber) {
				hex.Log.Add("Error","Error in " + url + " at " + lineNumber)
				hex.Log.Add("Error","Error Text" + message)
			}
			
		}
	 }
	,CoreLoaded : function () {
		hex.Component.Clear()
		var strOldID = hex.ID 
		hex.Log.Add("Core","Apply Core Config Changes...")
		
		if (hex.Config["Core"]) { 
			for (var objVar in hex.Config["Core"]) {
				if (hex[objVar]) {
					hex.Log.Add("Core","Changing Core setting [[" + objVar + "]] FROM [$" + hex[objVar] + "$] TO [$" + hex.Config["Core"][objVar] + "$]")
					hex[objVar] = hex.Config["Core"][objVar];
				}
			}
		}
		for (var objCore in hex.Core) {
			if (hex.Core[objCore] != null) {
			var objComp = hex.$(strOldID + "_" + hex.Core[objCore].ID + "_script")
			if (objComp != null) {
				if (objComp.readyState) {
					objComp.onreadystatechange = null
				}else{
					objComp.onload = null
				}
				objComp.id = hex.ID + "_" + hex.Core[objCore].ID + "_script";
			}
			objComp = null
			}
		}
		hex.Component.onLoaded = hex.ModsLoaded
		hex.Component.Load("Mods")
	}
	,Config				: {
		 Apply			: function () {
			hex.Log.Add("Core","Apply Component Config Changes...")
			for (var objComponent in this) {
				if (objComponent != "Core" && objComponent != "Apply" && objComponent != "ApplyConfig") {
					this.ApplyToComp(objComponent);
				}
			}
		}
		,ApplyToComp 	: function(objComponent) {
			for (var objVar in this[objComponent]) {
				if (hex[objComponent]) {
					hex.Log.Add("Core","Changing Component [[" + objComponent + "]] setting [[" + objVar + "]] FROM [$" + hex[objComponent][objVar] + "$] TO [$" + hex.Config[objComponent][objVar].toString() + "$]")

					hex[objComponent][objVar] = this[objComponent][objVar];
				}
			}
		}
		
	 }
	,ModsLoaded 		: function () {
		hex.Config.Apply()
		
		if (hex.useEventManager && (hex.EventManager)) {
			hex.Log.Add("Core","Setting Window Events")
			if (!hex.WindowEvent.loaded) { 
				
				hex.EventManager.Add(window,"onload",hex.WindowEvent.onLoad,true)
			}else{
				hex.WindowEvent.onLoad()
			}
			hex.EventManager.Add(window,"onunload",hex.EventManager.CleanUp)
			hex.WindowEvent.Register()
		}else{
			if (hex.WindowEvent.loaded) { 
				hex.WindowEvent.onLoad()
			}
		}
		
	}
	,onLoad : {
		 Loaded : false
		,Functs : {}
		,Count : 0
		,Trigger	: function() {
			
			hex.Log.Add("onLoad","Triggering onload Functions")
			for (var objFunc in this.Functs) {
				if (this.Functs[objFunc]) {
					hex.Log.Add("onLoad","Triggering onload Function: [$" + objFunc + "$]")
					this.Functs[objFunc]()
				}
			}
			this.Loaded = true
		}
		,Add		: function(objFunc) {
			hex.Log.Add("onLoad","Adding onload Function: [$" + objFunc + "$]")
			if (!this.Loaded) {
				this.Count += 1
				this.Functs[this.Count] = objFunc
			}else{
				objFunc()
			}
		}
	}
	,WindowEvent				: {
		 loaded			: false
		,Registered		: false
		,Events	: {
			Count : 0
		}
		,onLoad			: function() {
			
			hex.Log.Add("Core","[$Window loaded$]")
			hex.Component.Initialise("Core")
			hex.Component.Initialise()
			
			hex.onLoad.Trigger()
			//initPage()
		 }
		,Add			: function(strEvent,objFunc) {
			hex.Log.Add("WindowEvent","Adding Event [[" + strEvent + "]] [$" + objFunc + "$]")
			if (!hex.WindowEvent.loaded) {
			this.Events.Count += 1
 			if (hex.WindowEvent.loaded && (strEvent == "onload" || strEvent == "load")) {
				objFunc()
			}else{
				this.Events[this.Events.Count] = {
					 Event : strEvent
					,Funct : objFunc
				}
			}
			}else{
				hex.EventManager.Add(window,strEvent,objFunc)
			}
		}
		,Register		: function() {
			hex.Log.Add("WindowEvent","Number of Events to Register [$" + this.Events.Count + "$]")
			if (!this.Registered) {
			for (var objEvent in this.Events) {
				if (objEvent != "Count") {
					if (hex.WindowEvent.loaded && (this.Events[objEvent].Event == "onload" || this.Events[objEvent].Event == "load") ) {
						hex.Log.Add("WindowEvent","Window Loaded, Trigering [[" + this.Events[objEvent].Event+ "]] Event: [$" + this.Events[objEvent].Funct + "$]")
						this.Events[objEvent].Funct()
					}else{
						hex.Log.Add("WindowEvent","Registering Event [[" + this.Events[objEvent].Event + "]] [$" + this.Events[objEvent].Funct + "$]")
						hex.EventManager.Add(window,this.Events[objEvent].Event,this.Events[objEvent].Funct)
					}
				}
			}
				this.Registered = true
			}
		}
		,Remove			: function() {
		}
		,onUnload		: function() {
			hex.EventManager.CleanUp()
		 }
	}

	,Component			: {
	 	 Count			: 0
		,intCurLoaded	: 0
		,Folder			: null
		,StyleFolder	: null
		,onLoaded		: null
		,Modules		: {}
		,Add 		: function (strName,strFile,strPath,strGroup) {
			if (strGroup == null) {				
				if (strPath == null) {
					strPath = "Components"
				}
				strGroup = "Mods";				
			}
			
			if (!this.Modules[strGroup]) {				
				this.Modules[strGroup] = {}		
			}
			this.Modules[strGroup][strName] = {
				 ID		: strName
				,Path 	: strPath
				,File	: strFile
			}
		 }
		,Load 		: function (strGroup,strTempRoot) {
			hex.Log.Add("Core","Loading Components...")
			this.Count 			= 0;
			this.intCurLoaded 	= 0;
			if (strTempRoot == null) {strTempRoot = hex.RootPath}
			for (var objModule in this.Modules[strGroup]) {
				this.Count += 1
			}
			for (var objModule in this.Modules[strGroup]) {
				//this.Count += 1
				
				var objComp = hex.$$("script");
				objComp.id		= hex.ID + "_" + this.Modules[strGroup][objModule].ID + "_script";
				objComp.language 	= "javascript";		
				objComp.type 		= "text/javascript";
				var strPath 		= this.Modules[strGroup][objModule].Path;

				strPath = (strPath != null && (hex.Folders[strPath])) ? hex.Folders[strPath].root + "/" : "";	
				strPath = strTempRoot + strPath + this.Modules[strGroup][objModule].File + ((hex.Development) ? "?rID=" + Math.floor(Math.random()*90000) : "");

				objComp.src 		= strPath;
				hex.Log.Add("Core","Loading Component: [[" + this.Modules[strGroup][objModule].ID + "]], Path: [$" + objComp.src + "$]" )	
				hex.$$$("head")[0].appendChild(objComp);
							
				if (objComp.readyState) {
					if (objComp.readyState.toString() == "loaded" || objComp.readyState.toString() == "complete") {
						hex.Log.Add("Core","Component Loaded: [$"+ objComp.src + "$]")
						hex.Component.Loaded();
					}else{
						objComp.onreadystatechange = function () {
							hex.Log.Add("Core","Component [[" + this.src + "]] Readeystate: [$" + this.readyState.toString() + "$]" )
							if (this.readyState.toString() == "loaded" || this.readyState.toString() == "complete") {
								hex.Log.Add("Core","Component Loaded: [$ "+ this.src + "$]")
								hex.Component.Loaded();
							};
						};
					};
					
				}else{
					objComp.onload  = function () {
						hex.Log.Add("Core","Component Loaded: "+ this.src )
						hex.Component.Loaded();
					};
					objComp.onError = function () {
						hex.Log.Add("Core","Component load Error: "+ this.src )
					}
				};
				objComp = null;
			};
		 }
		,Loaded		: function () {
			this.intCurLoaded += 1
			if (this.intCurLoaded >= this.Count)  {		
				if (this.onLoaded) {
					this.onLoaded();
				};
			};
		 }
		 ,Initialise	: function (strGroup) {
			strGroup = (strGroup == null) ? "Mods" :strGroup
			for (var objModule in this.Modules[strGroup]) {
				//hex.Log.Add("Test",hex[objModule])
				//var blnValidModule = hex[objModule]
				var objTempModule = hex[objModule]
				if (objModule.indexOf(".") > 0) {
					var arrModule = objModule.split(".")
					var strModule = "hex"
					for (var i=0;i<arrModule.length;i++) {
						strModule += "['" + arrModule[i] + "']"
					}
					objTempModule = eval(strModule)
				}
				if (objTempModule) {
					if (objTempModule.StyleSheet !=null) {
						var strTempPath = hex.RootPath + hex.Folders.GetFullPath("styles") + objTempModule.StyleSheet
						hex.Log.Add("Core","Loading Component Style Sheet [[" + strTempPath +"]]")
						hex.LoadStyleSheet(strTempPath)
					}
					if (typeof objTempModule.Skin == 'object') {
						if (typeof objTempModule.Skin.Name == 'object' && (objTempModule.Skin.Name == null)) {
							objTempModule.Skin.Name = hex.Skin
						}
						if (typeof objTempModule.Skin.StyleSheet == 'object' && (objTempModule.Skin.StyleSheet != null)) {
							var strTempPath = null
							if (objTempModule.Skin.CssPath == null) {
								strTempPath = hex.RootPath + hex.xSkinFolder + hex.Skins[objTempModule.Skin.Name].Folder + "/" + hex.Skins[objTempModule.Skin.Name].CssFolder + "/" + objTempModule.Skin.StyleSheet
							}
							if (strTempPath != null) { hex.LoadStyleSheet(strTempPath)};
							//hex.LoadStyleSheet(strTempPath,function() {hex.DebugConsole.Resize()});
						}
						if (typeof objTempModule.Skin.ImagesPath == 'object'  && (objTempModule.Skin.ImagesPath == null)) {
							var strTempPath = hex.RootPath + hex.xSkinFolder + hex.Skins[objTempModule.Skin.Name].Folder + "/" + hex.Skins[objTempModule.Skin.Name].ImagesFolder + "/"
						}
					}
					
					if (objTempModule.Initialise) {
						hex.Log.Add("Core","Initialising Module: "+ objModule + ((objTempModule.Version) ? " Version [$" + objTempModule.Version + "$]" : "") )
						objTempModule.Initialise()
					}else{
						hex.Log.Add("Core","Initialising Module: "+ objModule + ((objTempModule.Version) ? " Version [$" + objTempModule.Version + "$]" : "") + " - [$NO INIT$]")
					}
				}
			}
		  }
		 ,Clear			: function (objModule) {
			 if (this.Modules[objModule]) {
			 	this.Modules[objModule]	 = null;
				this.Count -= 1;
				this.intCurLoaded -= 1;
			 }else{
			 //	this.ClearAll()
			 }
			  
		 }
		 ,ClearAll		: function () {
			for (var objModule in this.Modules) {
				this.Modules[objModule]	 = null;
			}
			this.Modules		= {}
			this.Count = 0;
			this.intCurLoaded = 0;
			this.onLoaded = null;
		 }
		,Terminate		: function() {
			for (var objGroup in this.Modules) {
				for (var objModule in this.Modules[objGroup]) {
					hex.Log.Add("Core","Terminating Module: "+ objModule )
					if (hex[objModule] && (hex[objModule].Terminate)) {
						hex[objModule].Terminate()
					}
				}
			}
		 }
	 }
	,LoadStyleSheet		: function (strPath,strID,onloadfunc) {
		hex.Log.Add("Core","Loading Style Sheet [$" + strPath + "$]")
		var objStyle = hex.$$("LINK");
		objStyle.href = strPath + ((hex.Development) ? "?rID=" + Math.floor(Math.random()*90000) : "");
		if (strID != null) {objStyle.id = strID};
		objStyle.rel = "stylesheet";
		objStyle.type = "text/css";
		
		if (onloadfunc != null) {
		if (objStyle.readyState) {
			if (objStyle.readyState.toString() == "loaded" || objStyle.readyState.toString() == "complete") {
				hex.Log.Add("Core","Style Sheet [[" + this.href + "]] - [$Loaded$]")
				onloadfunc()
			}else{
				objStyle.onreadystatechange = function () {
					if (this.readyState.toString() == "loaded" || this.readyState.toString() == "complete") {
						hex.Log.Add("Core","Style Sheet [[" + this.href + "]] - [$Loaded$]")
					onloadfunc()
					}
				};
			};
		}else{
			objStyle.onload  = function () {
				hex.Log.Add("Core","Style Sheet [[" + this.href + "]] - [$Loaded$]")
				onloadfunc()
			};
			objStyle.onError = function () {
				hex.Log.Add("Core","Style Sheet [[" + this.href + "]] - [$Loaded$]")
				//onloadfunc()
			}
		};
		}
		hex.$$$("head")[0].appendChild(objStyle);
		objStyle = null;
	 }
	,Log				: {
		 Logs			: {}
		,NewLineChar	: "<br />"
		,ReturnLogName	: true
		,Reverse		: false
		,Format			: true
		,FullLog		: {
			Count : 0
		}
		,AddLog			: function(strLogRef) {
			if (!this.Logs[strLogRef]) {
				this.Logs[strLogRef] = {
					Count : 0
				}
			}
		 }
		,Add			: function(strLogRef,strLogLine) {
			if (!this.Logs[strLogRef]) {
				this.AddLog(strLogRef)
			}
		 	if (hex.CreateLog && (this.Logs[strLogRef])) {
				this.Logs[strLogRef].Count += 1;
				this.Logs[strLogRef][this.Logs[strLogRef].Count] = strLogLine
				
				if (hex.useDebugConsole && (hex.Debug && (hex.DebugConsole && (hex.DebugConsole.Update)))) {
					hex.DebugConsole.Update(2,strLogRef,this.Logs[strLogRef].Count)
				}
			}
			this.FullLog.Count += 1
			this.FullLog[this.FullLog.Count] = {
				 LogRef : strLogRef
				,LogLine : strLogLine
			}
		 }
		,getLogs 		: function(strLogRef) {
		 	var strReturn = ""
			if (strLogRef != null) {
				if (strLogRef == "Full") {
					for (var objLine in this.FullLog) {
						if (objLine != "Count") {
							var strLine = this.FormatLog(this.FullLog[objLine].LogLine) + hex.Log.NewLineChar
							strReturn = (!this.Reverse) ? strReturn + strLine : strLine + strReturn;
						}
					}
				}else{
				strReturn = this.getLog(strLogRef)
				}
			}else{
				for (var objLog in this.Logs) {
					var strLine = this.getLog(objLog) + hex.Log.NewLineChar + hex.Log.NewLineChar;
					strReturn = (!this.Reverse) ? strReturn + strLine : strLine + strReturn;
				}
			}
			return strReturn
		  }
		,getLog			: function (strLogRef) {
			var strReturn = ""
			if (this.ReturnLogName) {
				var strLine = " ==== " + strLogRef + " ====" + hex.Log.NewLineChar
				strReturn = (!this.Reverse) ? strReturn + strLine : strLine + strReturn;
			}
			for (var objLine in this.Logs[strLogRef]) {
				if (objLine != "Count") {
					var strLine = this.Logs[strLogRef][objLine] + hex.Log.NewLineChar
					strReturn = (!this.Reverse) ? strReturn + strLine : strLine + strReturn;
				}
			}
			return this.FormatLog(strReturn)
		 }
		,getLine		: function(intLine,strLogRef,blnLineCount) {
			var strReturn = ""
		 	if (strLogRef != null) {
				if (intLine <= this.Logs[strLogRef].Count) {
					strReturn = this.Logs[strLogRef][intLine]
				}
			}else{
				var intLineCount = 0
				for (var objLog in this.Logs) {
					for (var objLine in this.Logs[objLog]) {
						intLineCount += 1;
						if (intLineCount == intLine) {
							strReturn = this.Logs[objLog][objLine]
						}
					}
				}
			}
			//return intLine + ": "+ this.Logs[strLogRef][this.Logs[strLogRef].Count]+ hex.Log.NewLineChar
			return ((blnLineCount) ? intLine + ": " : "") + this.FormatLog(strReturn) + hex.Log.NewLineChar
		 }
		,getLogList		: function () {
			var arrReturn = new Array()
			if (this.FullLog.Count > 0) {
				arrReturn.push("Full")
			}
			for (var objLog in this.Logs) {
				arrReturn.push(objLog)
			}
			return arrReturn
		 }
		,FormatLog		: function(strToFormat) { 
			if (this.Format) {
				strToFormat = strToFormat.replace(/\[\=/g,"<div style='text-align: center; border-bottom: solid 1px #ff0000; margin: 10px;'>")
				strToFormat = strToFormat.replace(/\=\]/g,"</div>")
				strToFormat = strToFormat.replace(/\[\[/g,"<span style='color: #0000FF;'>")
				strToFormat = strToFormat.replace(/\]\]/g,"</span>")
				strToFormat = strToFormat.replace(/\[\$/g,"<span style='color: #FF0000;'>")
				strToFormat = strToFormat.replace(/\$\]/g,"</span>")
			}
			return strToFormat
		}
	 }
	,Debug				: function (strValue,blnClear,blnNoLineBreak,blnLockView) {
		if (hex.useDebugConsole && (hex.DebugConsole)) {
			hex.DebugConsole.Output.Add(strValue,blnClear,blnNoLineBreak,blnLockView)
			hex.DebugConsole.Maximise()
		}
	 }
	,Terminate 			: function () {
		hex.Component.Terminate()
	}	 
}

hex.Initialise()

/********Change Log
V.1.2.0.7
** Fixed a bug with IE9 triggering the onload function twice

V.1.2.0.6
** Fixed bug with finding the root path to the hex folder

V.1.2.0.5
** Added Xml Functions to core

V.1.2.0.4
** Fixed a bug in the root path script in IE8

V.1.2.0.3
** Added function to automatically find the root path
** Added function to add sub components in seperate files
** Added function [InsertIntoBody] to insert HTML Obect into the body of the page
** Added to the function [$$ : create Element] the option to define attributes when created

V.1.2.0.2
** Fixed Bug with window onload event being triggered more the once

V.1.2.0.1






*/
