<%
'**********************************************************************************************************************
'Start write the page streaming section:  DO NOT TOUCH THIS CODE
'**********************************************************************************************************************
PageID = request("PageID")
Action = request("Action")
PageNumber = request("page")
blnComplete=Trim(request("blnComplete"))
if blnComplete = "" then
	blnComplete = False
else
	blnComplete = True
end if


Function CheckErr (ByRef msg)
	CheckErr = False
	If (Err <> 0) Then
		msg = "Error - " & Err.Description
		CheckErr = True
	End If
End Function

Function SendXML (address, data, timeout, isPost)
	On Error Resume Next
	Dim method : method = "GET"
	If (isPost) Then method = "POST"
	Dim oXML : Set oXML = Server.CreateObject("MSXML2.ServerXMLHTTP")
	If (CheckErr (SendXML)) Then Exit Function
	oXML.setTimeouts timeout*7, timeout*7, timeout*15, timeout*15
	oXML.Open method, address, False
	If (CheckErr (SendXML)) Then Exit Function
    oXML.setRequestHeader "Content-Type", "text/xml"
    oXML.Send data
	If (CheckErr (SendXML)) Then Exit Function

	If (oXML.status = 200) Then
		SendXML = oXML.responseText
	Else
		SendXML = "<!--Error - Response Status = " & oXML.status & "-->"
	End If

	If (CheckErr (SendXML)) Then Exit Function
	oXML = Nothing
End Function



	'on error resume next


	cDomain = trim(lcase(Replace(Request.ServerVariables("HTTP_HOST"),"local.", "")))
	if left(cDomain,4)="www." then
		cDomain = right(cDomain,(len(cDomain)-4))
	end if
	cParm = "?domain=" & cDomain
	cParm = cParm & "&agent=" & Server.URLEncode(Request.ServerVariables("HTTP_USER_AGENT"))
	cParm = cParm & "&referer=" & Server.URLEncode(Request.ServerVariables("HTTP_REFERER"))
	cParm = cParm & "&address=" & Server.URLEncode(Request.ServerVariables("REMOTE_ADDR"))
	cParm = cParm & "&uri=" & Server.URLEncode(Request.ServerVariables("URL"))
	cParm = cParm & "&query=" & Server.URLEncode(Request.ServerVariables("QUERY_STRING"))
	cParm = cParm & "&blnComplete=" & blnComplete  & "&page=" & PageNumber
	cParm = cParm & "&cScript=asp"

	data = ""
	timeout = 1000
	isPost =  false
%>



<%
	'get the meta tags section:
'================================================


	if not trim(PageID)="" then 'get meta tags from articles:
	address = "http://www.mysearchexchange.com/ArticleMeta.asp" & cParm & "&PageID=" & PageID
	strTemp = (SendXML (address, data, timeout, isPost))
	 strTemp = split(strTemp,"~")
	  SiteTitle = strTemp(0) 'This var need to be inside the Title Meta Tag of header part
	 SiteDesc = strTemp(1) 'This var need to be inside the Description Meta Tag of header part
	 SiteKeyWords = strTemp(2) 'This var need to be inside the Keywords Meta Tag of header part

	else 'get meta tags from domain:

	address = "http://www.mysearchexchange.com/ArticleMeta.asp" & cParm
	strTemp = (SendXML (address, data, timeout, isPost))
	 strTemp = split(strTemp,"~")
	  SiteTitle = strTemp(0) 'This var need to be inside the Title Meta Tag of header part
	 SiteDesc = strTemp(1) 'This var need to be inside the Description Meta Tag of header part
	 SiteKeyWords = strTemp(2) 'This var need to be inside the Keywords Meta Tag of header part

	end if

	 if PageNumber <> "" and Action = "Links" then ' we add it to title:
	  	SiteTitle = SiteTitle & " - " & PageNumber
	 end if

	'**********************************************************************************************************************
	' end streaming code. DO NOT modify code below
	'**********************************************************************************************************************
%>


<html>
<head>
<title> <%=SiteTitle%> </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="DESCRIPTION" content="<%=SiteDesc%>">
<meta name="KEYWORDS" content="<%=SiteKeyWords%>">


<%
'NOTE::::  Header tag will be closed! Do not modify above code!


'=======================================================================================================
' end hard code header for that site:
'=======================================================================================================
%>


<%
'**********************************************************************************************************************
'Stsrt write the page content section:  DO NOT TOUCH THIS PART OF CODE
'======================================================================================================================
	address = "http://www.mysearchexchange.com/Article.asp" & cParm & "&PageID=" & PageID & "&Action=" & Action
	Response.write(SendXML (address, data, timeout, isPost))
'======================================================================================================================
'End write the page content section:  DO NOT TOUCH THIS PART OF CODE
'**********************************************************************************************************************
%>

</html>
<%
'=======================================================================================================
' end hard code footer for that site:
'=======================================================================================================
%>


