<%

'*****************************************************************************
' Microsoft Content Management Server
'
' File: SDReportCommonHeader.INC
'
' Purpose:
'   ASP server-side include file that constructs the common <HEAD> section
'	tags found in various main report ASP files.  Tags include:
'		* <LINK> tag that references a CSS style sheet file
'		* <BASE> tag that specifies the Base URL for the document
'		* <SCRIPT> tag to include any commonly needed script files.
'
' GLOBAL DEPENDENCIES:
'	none.
'
'*****************************************************************************

	'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
	' Construct the report URL path where this script is located
	'	
	dim strProtocol
	dim strServerName
	dim strScriptPath
	dim strBaseUrl
	dim strServerPort

	' Fixes bug #7004 - previously, we hard coded "http://" on the base URL, 
	' which did not work properly in SSL scenarios.
	'
	' This returns either "on" if the request was made over SSL, or "off" if the
	' request was made in a non-secure fashion (regular HTTP).
	if LCase( Request.ServerVariables( "HTTPS" ) ) = "on" then
		strProtocol = "https://"
	else
		strProtocol = "http://"
	end if ' if HTTPS
	
	' This returns just the server name e.g. "cyclops"
	strServerName = Request.ServerVariables( "SERVER_NAME" )
	
	strServerPort = Request.ServerVariables( "SERVER_PORT" )	
	
	' This returns the path after the server name including the script filename
	' e.g. "/NR/System/ClientUI/Report/sdpostexportreport.asp"
	strScriptPath = Request.ServerVariables( "SCRIPT_NAME" )
	
	' truncate the script file name from its path
	dim lScriptNameIndex
	lScriptNameIndex = InStrRev( strScriptPath, "/")
	strScriptPath = Left( strScriptPath, lScriptNameIndex )
	
	' Now combine the server name with the path
	
	if strServerPort <> "80" then
		strBaseUrl = strProtocol & strServerName & ":" & strServerPort & strScriptPath
	else
		strBaseUrl = strProtocol & strServerName & strScriptPath
	end if
	
	'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
	' Compose the <BASE> tag as this:	
	'
	' <BASE HREF="http(s)://{server-name}{:port}/NR/System/ClientUI/Report/">
	'
	' NOTE: The <BASE> tag is required as long as the SD object model 
	' 		downloads the report from the server and invokes IE with a
	'		local path to the file. Since the images and scripts are not 
	'		downloaded to the local machine, an absolute base URL is
	' 		required.
	'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

	dim strBaseTag
	strBaseTag = "<BASE HREF=""" & strBaseUrl & """>"

	Response.Write( strBaseTag )
%>
	
<LINK rel="stylesheet" type="text/css" href="SDReports.css">

<SCRIPT language="JavaScript" src="SDReportScripts.JS" type="text/javascript">
</SCRIPT>