<!-- #include virtual="/NR/System/WBC/Customizable/OptionsServer_RT.inc" -->
<!-- #include virtual="/NR/Shared/WhatBrowser.inc" -->

<%
' ********************************************************************
' Copyright (C) 2001 Microsoft Corporation. All rights reserved.
'
'	IMPORTANT.  Please read the legal.txt file, located in the
'	"<CMS Install Directory>\Server\httpexec\WBC\Internals"
'	directory, governing the use of this internal file."
' ********************************************************************

' Define global constants
Const IDS_FRAMEWORK_VIRTUAL_PATH = "/NR/System/WBC"	' Path to WBC files. Also defined in CommonClient.js

Const IDS_EMIT_THINEDIT = "ThinEdit"
Const IDS_EMIT_VIEW = "View"
Const IDS_EMIT_WIN32EDIT = "Win32Edit"


' ---- "Never" is represented by "Jan 1, 3000"
Dim DATE_NEVER
DATE_NEVER = DateSerial(3000,1,1)

Dim IDCOL_MONTH
IDCOL_MONTH = Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")


' -----------------------------------------------------------------------------
'
'	[Public] Determine whether we are looking at a Posting or Channel
'
' -----------------------------------------------------------------------------
Function GetCurrentObject()
	' We cannot use AutoSession.This because it always returns Channel
	' if we are in a Framed Navigation script

	' We have to check for ThisPosting first because AutoSession.ThisChannel
	' is always true, so checking it first would not tell us much info
	If (Not AutoSession.ThisPosting Is Nothing) Then
		Set GetCurrentObject = AutoSession.ThisPosting
	ElseIf (Not AutoSession.ThisChannel Is Nothing) Then
		Set GetCurrentObject = AutoSession.ThisChannel
	End If
End Function

' -----------------------------------------------------------------------------
'
'	[Public] Determines whether page is before staged (site-stager) or crawled (web-crawler)
'
' -----------------------------------------------------------------------------
Function IsStagedOrCrawled()
	IsStagedOrCrawled = (IsUserAgentRobot Or AutoSession.IsModeStaging)
End Function

' -----------------------------------------------------------------------------
'
'	[Public] Determines if the WBC UI in the Unpublished mode is visible
'
' -----------------------------------------------------------------------------
Function IsWBCVisible()
	IsWBCVisible = False
End Function

' -----------------------------------------------------------------------------
'
'	[Public] Returns if the Posting exists on the server or not
'
' -----------------------------------------------------------------------------
Function IsExistingPosting( pPosting )
	IsExistingPosting = Not ((pPosting.State = "New") And (pPosting.StateApprovedVersion = "None"))
End Function

' -----------------------------------------------------------------------------
'
'	[Public] Format date to "DD MMM YYYY HH:MM:SS". This is the standard IETF
'			format as mentioned on the Date.parse() documentation in
'			"JavaScrip, The Definitive Guide" (
'
'	@param dateVal [in] - the Date object to be formatted as IETF date string
'
' -----------------------------------------------------------------------------
Function FormatDate( dateVal )
	FormatDate = Day(dateVal) & " " & IDCOL_MONTH(Month(dateVal)-1) & " " & Year(dateVal) & " " & _
					AddLeadingZero(Hour(dateVal)) & ":" & AddLeadingZero(Minute(dateVal)) & ":" & AddLeadingZero(Second(dateVal))
End Function

' -----------------------------------------------------------------------------
'
'	[Private] Add a leading zero to an integer if it is less than 10
'
' -----------------------------------------------------------------------------
Function AddLeadingZero(mynum)
	If mynum < 10 Then
		AddLeadingZero = "0" & mynum
	Else
		AddLeadingZero = mynum
	End If
End Function

' -----------------------------------------------------------------------------
'
'	[Public] Immediate If - something that exists in VB but not VBS
'
' -----------------------------------------------------------------------------
Function IIf(b, t, f)
	If b Then
		IIf = t
	Else
		IIf = f
	End If
End Function

' -----------------------------------------------------------------------------
'
'	[Public] Return the minimum of 2 values
'
' -----------------------------------------------------------------------------
Function Min(x, y)
	Min = IIf(x < y, x, y)
End Function

' -----------------------------------------------------------------------------
'
'	[Public] Return the maximum of 2 values
'
' -----------------------------------------------------------------------------
Function Max(x, y)
	Max = IIf(x > y, x, y)
End Function

' -----------------------------------------------------------------------------
'
'	[Public] This function appends querystring to a url
'
' -----------------------------------------------------------------------------
Function AppendQueryString(strBaseUrl, strQueryString)
	If InStr(strBaseUrl,"?") = 0 Then
		AppendQueryString = strBaseUrl & "?" & strQueryString
	Else
		AppendQueryString = strBaseUrl & "&" & strQueryString
	End If
End Function

' -----------------------------------------------------------------------------
'
'	[Public] Checks if we are in authoring mode or not
'
' -----------------------------------------------------------------------------
Function IsAuthoringMode
	IsAuthoringMode = False
End Function

' -----------------------------------------------------------------------------
'
'[Public]: 	Convert ASP boolean to Javascript boolean
'			The ASP boolean may not be "true" and "false" in some OS.
'			E.g. In German OS "wahr"="true" and "falscht"="false". This function
'			is to make sure the ASP boolean returning "true" and "false"
'			in order to	use when calling the Javascript function.
'
'Input:		bAspBoolean - an ASP boolean based on the OS
'
'Output:  	return "true" if the ASP boolean is meaning "true"; otherwise, returns "false"
'
' -----------------------------------------------------------------------------
Function Bool2LCaseStr(bASPBoolean)
	If bASPBoolean Then
		Bool2LCaseStr = "true"
	Else
		Bool2LCaseStr = "false"
	End If
End Function


AutoSession.SuppressExceptions = False
Call AutoSession.ClearLastError()
%>