<HTML>
<HEAD>
	<TITLE>Logger</TITLE>

	<HTA: APPLICATION ID="objLogger"
	APPLICATIONNAME="Logger"
	VERSION="1.00"
	BORDER="thin"
	BORDERSTYLE="normal"
	CAPTION="no"
	ICON=""
	MAXIMIZEBUTTON="no"
	MINIMIZEBUTTON="yes"
	SHOWINTASKBAR="yes"
	SINGLEINSTANCE="yes"
	SYSMENU="yes"
	SCROLL="no"
	WINDOWSTATE="normal"/>

<Script Language="VBScript">

Option Explicit 
On Error Resume Next
Dim InputFile, objShell, FSO, oFile
Dim	strName, strPath, myLang

Sub Window_OnLoad
	window.resizeTo 320,675
	Set objShell = CreateObject("Wscript.Shell")
	strPath = objShell.CurrentDirectory								'Get current directory to use as reference point
	Set FSO = CreateObject("Scripting.FileSystemObject")
	If NOT (FSO.FolderExists(strPath + "\Scripts")) Then FSO.CreateFolder(strPath + "\Scripts") 'Verify the existance of the script folder, if not found, create it,
	document.title = "Logger"	'Name of App in Title Bar
	myLang="en"
	PopulateResGroupScript
	PopulateCiPartiesScript
	PopulateKnowledgeScript
	PopulateSpecifiedScript
	PopulateRefScript
	PopulateContacts
End Sub


Sub Window_OnUnload
	ExitHTA
End Sub


Sub ExitHTA
	self.close()
End Sub


Sub ClearTicket
	PopulateResGroupScript
	PopulateCiPartiesScript
	PopulateKnowledgeScript
	PopulateSpecifiedScript
	PopulateRefScript
End Sub


Sub PopulateResGroupScript
	If (FSO.FileExists(strPath & "\Scripts\ScriptResGroup.txt")) Then		'Load the Other section
			InputFile = strPath & "\Scripts\ScriptResGroup.txt"
			Set oFile = FSO.OpenTextFile(InputFile)
			pResGroup.innerText = oFile.ReadAll
			oFile.Close
		Else
			pResGroup.innerText="ESD Update - Assigning to XXXXXXX_Default"
		End If
End Sub

Sub PopulateCiPartiesScript
	If (FSO.FileExists(strPath & "\Scripts\ScriptCiParties.txt")) Then		'Load the Other section
			InputFile = strPath & "\Scripts\ScriptCiParties.txt"
			Set oFile = FSO.OpenTextFile(InputFile)
			pCi.innerText = oFile.ReadAll
			oFile.Close
		Else
			pCi.innerText="as per interested party for CI XXXXXXX - XXXXXXXXXXX_Default"
		End If
End Sub

Sub PopulateKnowledgeScript
	If (FSO.FileExists(strPath & "\Scripts\ScriptKnowledge.txt")) Then		'Load the Other section
			InputFile = strPath & "\Scripts\ScriptKnowledge.txt"
			Set oFile = FSO.OpenTextFile(InputFile)
			pKnowledge.innerText = oFile.ReadAll
			oFile.Close
		Else
			pKnowledge.innerText="As per knowledgebase_Default"
		End If
End Sub

Sub PopulateSpecifiedScript
	If (FSO.FileExists(strPath & "\Scripts\ScriptSpecified.txt")) Then		'Load the Other section
			InputFile = strPath & "\Scripts\ScriptSpecified.txt"
			Set oFile = FSO.OpenTextFile(InputFile)
			pSpecified.innerText = oFile.ReadAll
			oFile.Close
		Else
			pSpecified.innerText="As per assignment specified in ticket details._Default"
		End If
End Sub


Sub PopulateRefScript
	If (FSO.FileExists(strPath & "\Scripts\ScriptCiRef.txt")) Then		'Load the Other section
			InputFile = strPath & "\Scripts\ScriptCiRef.txt"
			Set oFile = FSO.OpenTextFile(InputFile)
			pRef.innerText = oFile.ReadAll
			oFile.Close
		Else
			pRef.innerText="Ref:  Old CI: _Default"
		End If
End Sub

Sub PopulateContacts
	If (FSO.FileExists(strPath & "\Scripts\Contacts.txt")) Then		'Load the Other section
			InputFile = strPath & "\Scripts\Contacts.txt"
			Set oFile = FSO.OpenTextFile(InputFile)
			pContacts.innerText = oFile.ReadAll
			oFile.Close
		Else
			pContacts.innerText="<h3>Contacts</h3>"
		End If
End Sub


'Sub ToggleLanguage
'	If myLang="en" Then
'		'Make Stuff French
'		myLang="fr"
'		btnLanguage.value="English" 	  'Change text on the language button
'	Else
'		'Make Stuff English
'		myLang="en"
'		btnLanguage.value="Francais"	  'Toggle text on the language button back to Francais
'	End If
'	PopulateScript1
'	PopulateScript2
'End Sub


</SCRIPT>
<style type="text/css">
BODY {
	FONT-FAMILY: Georgia, Serif; TEXT-ALIGN: center ; BODY..MARGIN-TOP: 10px
}
#frame {
	WIDTH: 100% ; HEIGHT: 100%; TEXT-ALIGN: left; PADDING-RIGHT: 10px; PADDING-BAOTTOM: 10px
}
#main {
	font-size:70% ; WIDTH: 100% ; HEIGHT: 96%; BACKGROUND: #f5f5f5; PADDING-TOP: 10px; PADDING-BOTTOM: 5px; PADDING-LEFT: 10px; MARGIN: 5px; PADDING-RIGHT: 10px
}
#content {
	HEIGHT:95%; BORDER-TOP: #cccccc 1px dashed; BORDER-RIGHT: #cccccc 1px dashed; WIDTH: 100%; BACKGROUND: #FEFFC1; BORDER-BOTTOM: #cccccc 1px dashed; FLOAT: right; PADDING-BOTTOM: 5px; PADDING-TOP: 10px; PADDING-LEFT: 10px; BORDER-LEFT: #cccccc 1px dashed; MARGIN: 5px; PADDING-RIGHT: 10px; PADDING-BOTTOM: 10px
}
#content P {
	FONT-SIZE: 15px
}

H1 {
	FONT-SIZE: large
}
.button {
    background-color: #4CAF50; /* Green */
    border: none;
    color: white;
    padding: 1px 1px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
}
</style>
</HEAD>
<BODY SCROLL="yes">
<div id="frame" style="clear:both;">
   	
	<div id="content">
		<input type="button" class="button" name="Clear" value="Reset Scripts (Below)" title="Reload everything" onclick="ClearTicket">&nbsp;
		<!-- <input type="button" class="button" title="Toggle between modes" name="btnLanguage" value="Toggle Mode" onclick=""> -->
		
		<h4>Scripts</h4>
		
		<p id="pResGroup" contenteditable="true">Edit file in folder 'Scripts' named 'ScriptResGroup.txt' </p>
		<p id="pCi" contenteditable="true">Edit file in folder 'Scripts' named 'ScriptCiParties.txt' </p>
		<div id="pKnowledge" contenteditable="true"><br>Edit file in folder 'Scripts' named 'ScriptKnowledge.txt' </div>
		<div id="pSpecified" contenteditable="true"><br>Edit file in folder 'Scripts' named 'ScriptResGroup.txt' </div><br>
		<div id="pRef" contenteditable="true"><br>Edit file in folder 'Scripts' named 'ScriptCiRef.txt' </div><br>
		
		
		<input type="button" class="button" name="Clear" value="Reset Scritps (Above)" title="Reload everything" onclick="ClearTicket">&nbsp;
		<!-- <input type="button" class="button" title="Toggle between modes" name="btnLanguage" value="Toggle Mode" onclick=""><br> -->
		<h4>Contacts</h4>
		<div id="pContacts">Edit file in folder 'Scripts' named 'Contacts.txt' </div>
		
    </div>
    
  </div>
</BODY>
</HTML>