Index: /FCKeditor/trunk/fckeditor.asp
===================================================================
--- /FCKeditor/trunk/fckeditor.asp	(revision 416)
+++ /FCKeditor/trunk/fckeditor.asp	(revision 417)
@@ -78,11 +78,16 @@
 	End Property
 
-	Public Function Create( instanceName )
-
-		Response.Write "<div>"
+	' Generates the instace of the editor in the HTML output of the page.
+	Public Sub Create( instanceName )
+		response.write CreateHtml( instanceName )
+	end Sub
+
+	' Returns the html code that must be used to generate an instance of FCKeditor.
+	Public Function CreateHtml( instanceName )
+		dim html
 
 		If IsCompatible() Then
 
-			Dim sFile
+			Dim sFile, sLink
 			If Request.QueryString( "fcksource" ) = "true" Then
 				sFile = "fckeditor.original.html"
@@ -91,5 +96,4 @@
 			End If
 
-			Dim sLink
 			sLink = sBasePath & "editor/" & sFile & "?InstanceName=" + instanceName
 
@@ -98,12 +102,13 @@
 			End If
 
+			html = ""
 			' Render the linked hidden field.
-			Response.Write "<input type=""hidden"" id=""" & instanceName & """ name=""" & instanceName & """ value=""" & Server.HTMLEncode( sValue ) & """ style=""display:none"" />"
+			html = html & "<input type=""hidden"" id=""" & instanceName & """ name=""" & instanceName & """ value=""" & Server.HTMLEncode( sValue ) & """ style=""display:none"" />"
 
 			' Render the configurations hidden field.
-			Response.Write "<input type=""hidden"" id=""" & instanceName & "___Config"" value=""" & GetConfigFieldString() & """ style=""display:none"" />"
+			html = html & "<input type=""hidden"" id=""" & instanceName & "___Config"" value=""" & GetConfigFieldString() & """ style=""display:none"" />"
 
 			' Render the editor IFRAME.
-			Response.Write "<iframe id=""" & instanceName & "___Frame"" src=""" & sLink & """ width=""" & sWidth & """ height=""" & sHeight & """ frameborder=""0"" scrolling=""no""></iframe>"
+			html = html & "<iframe id=""" & instanceName & "___Frame"" src=""" & sLink & """ width=""" & sWidth & """ height=""" & sHeight & """ frameborder=""0"" scrolling=""no""></iframe>"
 
 		Else
@@ -123,9 +128,9 @@
 			End If
 
-			Response.Write "<textarea name=""" & instanceName & """ rows=""4"" cols=""40"" style=""width: " & sWidthCSS & "; height: " & sHeightCSS & """>" & Server.HTMLEncode( sValue ) & "</textarea>"
+			html = "<textarea name=""" & instanceName & """ rows=""4"" cols=""40"" style=""width: " & sWidthCSS & "; height: " & sHeightCSS & """>" & Server.HTMLEncode( sValue ) & "</textarea>"
 
 		End If
 
-		Response.Write "</div>"
+		CreateHtml = "<div>" & html & "</div>"
 
 	End Function
@@ -133,18 +138,5 @@
 	Private Function IsCompatible()
 
-		Dim sAgent
-		sAgent = Request.ServerVariables("HTTP_USER_AGENT")
-
-		Dim iVersion
-
-		If InStr(sAgent, "MSIE") > 0 AND InStr(sAgent, "mac") <= 0  AND InStr(sAgent, "Opera") <= 0 Then
-			iVersion = CInt( ToNumericFormat( Mid(sAgent, InStr(sAgent, "MSIE") + 5, 3) ) )
-			IsCompatible = ( iVersion >= 5.5 )
-		ElseIf InStr(sAgent, "Gecko/") > 0 Then
-			iVersion = CLng( Mid( sAgent, InStr( sAgent, "Gecko/" ) + 6, 8 ) )
-			IsCompatible = ( iVersion >= 20030210 )
-		Else
-			IsCompatible = False
-		End If
+		IsCompatible = FCKeditor_IsCompatibleBrowser()
 
 	End Function
@@ -205,3 +197,25 @@
 
 End Class
+
+
+' A function that can be used to check if the current browser is compatible with FCKeditor
+' without the need to create an instance of the class.
+Function FCKeditor_IsCompatibleBrowser()
+
+	Dim sAgent
+	sAgent = Request.ServerVariables("HTTP_USER_AGENT")
+
+	Dim iVersion
+
+	If InStr(sAgent, "MSIE") > 0 AND InStr(sAgent, "mac") <= 0  AND InStr(sAgent, "Opera") <= 0 Then
+		iVersion = CInt( ToNumericFormat( Mid(sAgent, InStr(sAgent, "MSIE") + 5, 3) ) )
+		FCKeditor_IsCompatibleBrowser = ( iVersion >= 5.5 )
+	ElseIf InStr(sAgent, "Gecko/") > 0 Then
+		iVersion = CLng( Mid( sAgent, InStr( sAgent, "Gecko/" ) + 6, 8 ) )
+		FCKeditor_IsCompatibleBrowser = ( iVersion >= 20030210 )
+	Else
+		FCKeditor_IsCompatibleBrowser = False
+	End If
+
+End Function
 %>
