<%@ LANGUAGE="VBSCRIPT" CODEPAGE=65001 %>
<%
' last modified 09 23 03
' last modified 02 11 03
Server.ScriptTimeOut = 9999
Response.ContentType="text/xml"
Response.Charset="UTF-8"
Dim vspeccode 
vgenus = Request.Querystring("genus")
vspecies = Request.Querystring("species")
'use it if url param
'vspeccode = Request.Querystring("speccode")
'use it if form param
'vspeccode = Request.form("speccode")
'set conn = server.createobject("adodb.connection")
'conn.open "fbapp"
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "DSN=fbapp_local"
'conn.open "DSN=fbapp_local","eagbayani","173173173"
set getid = conn.execute("SELECT SpecCode as ID from SPECIES WHERE GENUS = '" & vgenus & "' AND SPECIES = '" & vspecies & "'")
if not getid.eof then
	vspeccode = getid("id")	
else%><?xml version = "1.0" ?><?xml-stylesheet type="text/xsl" href="SpeciesSummary.xsl"?>
<!DOCTYPE fishbase
[
<!ELEMENT fishbase (species,growth*)>
	<!ELEMENT species (speccode,genus,speciesfb,author,family,commonname,subfamily,order,class,fbname,distribution,diagnosis,biology,maxsize,environment,climate,importance,threatened,dangerous,coordinator,mainref,picname)>
		<!ELEMENT speccode (#PCDATA)>
		<!ELEMENT genus (#PCDATA)>
		<!ATTLIST genus
			link CDATA #IMPLIED
		>		
		<!ELEMENT speciesfb (#PCDATA)>
		<!ATTLIST speciesfb
			link CDATA #IMPLIED
		>		
		<!ELEMENT author (#PCDATA)>
		<!ATTLIST author
			casrefno CDATA #IMPLIED
			link CDATA #IMPLIED
		>
		<!ELEMENT family (#PCDATA)>
		<!ATTLIST family
			link CDATA #IMPLIED
		>		
		<!ELEMENT commonname (#PCDATA)>
		<!ELEMENT subfamily (#PCDATA)>
		<!ELEMENT order (#PCDATA)>
		<!ATTLIST order
			link CDATA #IMPLIED
		>		

		<!ELEMENT class (#PCDATA)>
		<!ELEMENT fbname (#PCDATA)>
		<!ELEMENT distribution (#PCDATA)>
		<!ELEMENT diagnosis ANY>
		<!ELEMENT biology (#PCDATA)>
		<!ELEMENT maxsize (#PCDATA)>
		<!ELEMENT environment (#PCDATA)>
		<!ELEMENT climate (#PCDATA)>
		<!ELEMENT importance (#PCDATA)>
		<!ELEMENT threatened (#PCDATA)>
		<!ELEMENT dangerous (#PCDATA)>
		<!ELEMENT coordinator (#PCDATA)>
		<!ATTLIST coordinator
			link CDATA #IMPLIED
		>		
		<!ELEMENT mainref (#PCDATA)>
		<!ATTLIST mainref 
			refnum CDATA #IMPLIED
			link CDATA #IMPLIED
		>
		<!ELEMENT picname EMPTY>
		<!ATTLIST picname 
			src CDATA #IMPLIED
			link CDATA #IMPLIED
			alt CDATA #IMPLIED
		>		

	<!ELEMENT growth (linf,type,K,to,sex,M,temp)>
		<!ELEMENT linf (#PCDATA)>
		<!ELEMENT type (#PCDATA)>
		<!ELEMENT K (#PCDATA)>
		<!ELEMENT to (#PCDATA)>
		<!ELEMENT sex (#PCDATA)>
		<!ELEMENT M (#PCDATA)>
		<!ELEMENT temp (#PCDATA)>
		
	<!ENTITY nbsp  " " >		
]
>
<fishbase>
<species>
	<speccode></speccode>	
	<genus></genus>					
	<speciesfb></speciesfb>			
	<author></author>			
	<family></family>			
	<commonname></commonname>
	<subfamily></subfamily>		
	<order></order>	
	<class></class>
	<fbname></fbname>	
	<distribution></distribution>			
	<diagnosis></diagnosis>	
	<biology></biology>		
	<maxsize></maxsize>	
	<environment></environment>	
	<climate></climate>	
	<importance></importance>	
	<threatened></threatened>	
	<dangerous></dangerous>		
	<coordinator></coordinator>			
	<mainref></mainref>				
	<picname/>	
</species>
</fishbase><%	
	response.end			
end if

set sp = conn.execute("SELECT FAMILIES.Family, FAMILIES.Order, FAMILIES.Class, SPECIES.*, STOCKS.StockDefs, STOCKS.IUCN_Code, STOCKS.IUCN_Assessment, STOCKS.IUCN_Assessor, STOCKS.IUCN_Text, STOCKS.pHMin, STOCKS.pHMax, STOCKS.dHMin, STOCKS.dHMax, STOCKS.GenBankID, STOCKS.RfeID, STOCKS.FIGIS_ID, FAMILIES.FamilyExpert, FAMILIES.CommonName, STOCKS.EnvTemp, STOCKS.Northernmost, STOCKS.NorthSouthS, STOCKS.Southermost, STOCKS.NorthSouthN, STOCKS.TempMin, STOCKS.TempMax FROM (SPECIES LEFT JOIN STOCKS ON SPECIES.SpecCode = STOCKS.SpecCode) LEFT JOIN FAMILIES ON SPECIES.FamCode = FAMILIES.FamCode WHERE (((SPECIES.SpecCode)=" & vspeccode & ") AND ((STOCKS.Level)='species in general' Or (STOCKS.Level)='subspecies in general'))")

'start of pic
dim picname
picname=""
set getpic = conn.execute("SELECT PicturesMain.PicName, PicturesMain.AuthName,picturesmain.entered FROM PicturesMain LEFT JOIN PictureType ON PicturesMain.PictureType = PictureType.PictureType WHERE (((PicturesMain.SpecCode)=" & vspeccode & ") AND ((PicturesMain.Scanned)=Yes) AND ((PicturesMain.LifeStage)<>'larvae' And (PicturesMain.LifeStage)<>'egg')) ORDER BY PictureType.ranktype, PicturesMain.Rank;")
if not getpic.eof then
	picname = getpic("picname")
	if Right(picname, 3) = "jpg" then
		picname = "../images/thumbnails/jpg/tn_" & picname
	else
		picname = "../images/thumbnails/gif/tn_" & picname
	end if
end if
getpic.close
'end of pic


'start of coordinator
Dim coordinator,coordinator_id
coordinator=""
coordinator_id=""
if sp("coordinator") <> "" then
	IF sp("coordinator") <> "" then
		coordinator=sp("coordinator")
	end if
else
	IF sp("familyexpert") <> "" then
		coordinator=sp("familyexpert")
	end if
end if
coordinator_id = coordinator
if coordinator <> "" then
	set coor = conn.execute("Select Collaborators.Surname, Collaborators.Prename From Collaborators Where Collaborators.Personnel = " & coordinator )
	coordinator=""
	
	if not coor.eof then
	if coor("Surname") <> "" then
		coordinator = coor("Surname") & ", " & coor("Prename")
	ELSE
		coordinator = ""
	end if
	coordinator = coor("Surname") & ", " & coor("Prename")
	end if
	
	coor.close
else
	coordinator = ""
end if
'end of coordinator

'start of main ref
dim mainref,refnum
mainref=""
if sp("SpeciesRefNo") <> "" then
	set getauth = conn.execute("select Author, Year from Refrens where refno =" & sp("SpeciesRefNo"))
	mainref = getauth("author") & ". " & getauth("year") 	
	mainref	= Replace(mainref, "é","&#233;" )
	refnum = sp("SpeciesRefNo")
	getauth.close
else
	mainref=""
end if
'end of main ref

'start of growth rec
set gr = conn.execute("SELECT Log([k])/Log(10)+2*Log([loo])/Log(10) AS Q, POPGROWTH.*, COUNTREF.PAESE FROM POPGROWTH LEFT JOIN COUNTREF ON POPGROWTH.C_Code = COUNTREF.C_Code WHERE (((POPGROWTH.SpecCode)=" & vspeccode & ")) ORDER BY Log([k])/Log(10)+2*Log([loo])/Log(10)")
'end of growth rec


'start of diagnosis
set sp2 = conn.execute("SELECT morphdat.* FROM morphdat WHERE (((morphdat.SpecCode)=" & vspeccode & "))")
Dim diagnosis
diagnosis=""

do while not sp2.eof
if sp2("dorsalspinesmin") <> "" or sp2("dorsalspinesmax") <> "" then
	If diagnosis <> "" then
    	diagnosis = diagnosis & "; Dorsal spines (total): "
	Else
    	diagnosis = "Dorsal spines (total): "
    end if
	if sp2("dorsalspinesmin") <> "" then
    	diagnosis = diagnosis & sp2("dorsalspinesmin")
    end if
	if sp2("dorsalspinesmax") <> "" then
    	If Right(diagnosis, 1) = " " then
            diagnosis = diagnosis & sp2("dorsalspinesmax")
        else
        	diagnosis = diagnosis & "-" & sp2("dorsalspinesmax")
        end if
	end if
end if

if sp("class") <> "Elasmobranchii (sharks and rays)" then
if sp2("dorsalsoftraysmin") <> "" or sp2("dorsalsoftraysmax") <> "" then
	If diagnosis <> "" then
    	diagnosis = diagnosis & "; Dorsal softrays (total): "
	else
    	diagnosis = "Dorsal softrays (total): "
    end if
	if sp2("dorsalsoftraysmin") <> "" then
		diagnosis = diagnosis & sp2("dorsalsoftraysmin")
    end if
	if sp2("dorsalsoftraysmax") <> "" then
    	if Right(diagnosis, 1) = " " then
        	diagnosis = diagnosis & sp2("dorsalsoftraysmax")
		else
            diagnosis = diagnosis & "-" & sp2("dorsalsoftraysmax")
        end if
	end if
end if
end if

if sp2("analfinspinesmin") <> "" or sp2("analfinspinesmax") <> "" then
	If diagnosis <> "" then
    	diagnosis = diagnosis & "; Anal spines: "
    Else
    	diagnosis = "Anal spines: "
    end if
	if sp2("analfinspinesmin") <> "" then
    	diagnosis = diagnosis & sp2("analfinspinesmin")
    end if
	if sp2("analfinspinesmax") <> "" then
    	If Right(diagnosis, 1) = " " then
        	diagnosis = diagnosis & sp2("analfinspinesmax")
        Else
	    	diagnosis = diagnosis & "-" & sp2("analfinspinesmax")
        end if
	end if
end if

if sp("class") <> "Elasmobranchii (sharks and rays)" then
if sp2("araymin") <> "" or sp2("araymax") <> "" then
	if diagnosis <> "" then
    	 diagnosis = diagnosis & "; Anal soft-rays: "
	else
         diagnosis = "Anal soft-rays: "
    end if
	if sp2("araymin") <> "" then
    	 diagnosis = diagnosis & sp2("araymin")
    end if
	if sp2("araymax") <> "" then
 		if Right(diagnosis, 1) = " " then
        	 diagnosis = diagnosis & sp2("araymax")
        else
             diagnosis = diagnosis & "-" & sp2("araymax")
        end if
	end if
end if
end if

if sp2("Vertebraetotalmin") <> "" or sp2("Vertebraetotalmax") <> "" then
	if diagnosis <> "" then
    	diagnosis = diagnosis & "; Vertebrae: "
	else
        diagnosis = "Vertebrae: "
    end if
	if sp2("Vertebraetotalmin") <> "" then
    	diagnosis = diagnosis & sp2("Vertebraetotalmin")
    end if
	if sp2("Vertebraetotalmax") <> "" then
 		if Right(diagnosis, 1) = " " then
        	diagnosis = diagnosis & sp2("Vertebraetotalmax")
        else
            diagnosis = diagnosis & "-" & sp2("Vertebraetotalmax")
        end if
	end if
end if

'if sp2("addchars") = "" then
'else
'	if diagnosis = "" then    	
'		diagnosis = sp2("addchars")
'    else
'		diagnosis = diagnosis & ". " & sp2("addchars")    	
'    end if
'end if

diagnosis = diagnosis & ". " & sp2("addchars")    	

'test...result is as expected, syntax works...
'diagnosis = ""
'if diagnosis <> "" then
'	diagnosis = "meron"
'else
'	diagnosis = "wala"
'end if


sp2.movenext
loop 
sp2.close

'end of diagnosis
'###########################################################################
'###########################################################################
'###########################################################################
'###########################################################################
'###########################################################################
Dim maxsize,environment,climate,importance,threatened
do while not sp.eof
'start of threatened
threatened=""
if sp("IUCN_Code") 		= "EX"		then 
	threatened = "Extinct"
elseif sp("IUCN_Code") 	= "EW"		then threatened = "Extinct in the Wild"
elseif sp("IUCN_Code") 	= "CR"		then threatened = "Critically Endangered"
elseif sp("IUCN_Code") 	= "EN"		then threatened = "Endangered"
elseif sp("IUCN_Code") 	= "VU"		then threatened = "Vulnerable"
elseif sp("IUCN_Code") 	= "LR"		then threatened = "Lower Risk"
elseif sp("IUCN_Code") 	= "LR (cd)"	then threatened = "Lower Risk: conservation dependent"
elseif sp("IUCN_Code") 	= "LR (nt)"	then threatened = "Lower Risk: near threatened"
elseif sp("IUCN_Code") 	= "LR (lc)"	then threatened = "Lower Risk: least concern"
elseif sp("IUCN_Code") 	= "DD"		then threatened = "Data deficient"
elseif sp("IUCN_Code") 	= "NL"		then threatened = "Not in IUCN Red List"
elseif sp("IUCN_Code") 	= "N.E."	then threatened = "Not Evaluated"
elseif sp("IUCN_Code") 	= "N.A."	then threatened = "Not Applicable"
end if

threatened = threatened & " (" & sp("IUCN_Assessment") & ")"
if sp("IUCN_Assessor") <> "" then
	threatened = threatened & ", " & sp("IUCN_Assessor")
end if	
threatened = threatened & ", (Ref. 36508)"
if sp("IUCN_Text") <> "" then
	threatened = threatened & ", " & sp("IUCN_Text")
end if

  

'end of threatened





'start of importance

if sp("Importance") <> "" then
	Importance = "fisheries: " & sp("Importance")
else
	Importance = ""
end if

if sp("UsedforAquaculture") <> "never/rarely" and sp("UsedforAquaculture") <> "" then
	if sp("Importance") <> "" then
		Importance = Importance & "; aquaculture: " & sp("UsedforAquaculture")
	else
		Importance = Importance & "aquaculture: " & sp("UsedforAquaculture")
	end if
end if

if sp("GameFish") = "True" then
	if Importance <> "" then
		Importance=Importance & "; gamefish: yes"
	else
		Importance=Importance & "gamefish: yes"
	end if
end if

if sp("Aquarium") <> "never/rarely" and sp("Aquarium") <> "" then
	if Importance <> "" then
		Importance=Importance & "; aquarium: " & sp("Aquarium")
	else
		Importance=Importance & "aquarium: " & sp("Aquarium")
	end if
end if

if sp("UsedasBait") <> "never/rarely" and sp("UsedasBait") <> "" then
	if Importance <> "" then
		Importance=Importance & "; bait: " & sp("UsedasBait")
	else
		Importance=Importance & "bait: " & sp("UsedasBait")
	end if
end if

'end of importance




'start of climate
climate = sp("EnvTemp")
	
if sp("TempMin") <> "" then
	if climate = "" then
		climate = sp("TempMin")
		'format 999
	else
		climate = climate & "; " & sp("TempMin")
		'format 999
	end if
		
		
	if sp("TempMax") <> "" then
		if climate = "" then
			climate = sp("TempMax") & "&#176;" & "C"
		else
			climate = climate & " - " & sp("TempMax") & "&#176;" & "C"
		end if
	end if
else
	if sp("TempMax") <> "" then
		if climate = "" then
			climate = sp("TempMax") & "&#176;" & "C"
		else
			climate = climate & "; " & sp("TempMax") & "&#176;" & "C"
		end if
	end if
end if


if sp("NorthernMost") <> "" then
	Climate = Climate & "; " & sp("NorthernMost") & "&#176;" & sp("NorthSouthN")
	if sp("SoutherMost") <> "" then
		Climate = Climate & " - " & sp("SoutherMost") & "&#176;" & sp("NorthSouthS")
	else
		'<!--- parang hindi na ito kailangan
		' ClimateZone = #ClimateZone# & 'C'>	
		'--->
	end if
else
	if sp("SoutherMost") <> "" then
		Climate = Climate & "; " & sp("SoutherMost") & "&#176;" & sp("NorthSouthS") & "C"
	end if
end if


'end of climate





'start of environment
Environment = sp("DemersPelag")
if sp("fresh") = True then
   	Environment = Environment & "; freshwater"
end if
if sp("brack") = True then
   	Environment = Environment & "; brackish"
end if
if sp("saltwater") = True then
   	Environment = Environment & "; marine"
end if


if sp("pHMin") <> "" and sp("pHMax") <> "" then
	Environment = Environment & "; pH range: " & sp("pHMin") & " - " & sp("pHMax")
elseif sp("pHMin") <> "" and sp("pHMax") = "" then
	Environment = Environment & "; pH range: " & sp("pHMin")
elseif sp("pHMin") = "" and sp("pHMax") <> "" then
	Environment = Environment & "; pH range: " & sp("pHMax")
end if
	
if sp("dHMin") <> "" and sp("dHMax") <> "" then
	Environment = Environment & "; dH range: " & sp("dHMin") & " - " & sp("dHMax")
elseif sp("dHMin") <> "" and sp("dHMax") = "" then
	Environment = Environment & "; dH range: " & sp("dHMin")
elseif sp("dHMin") = "" and sp("dHMax") <> "" then
	Environment = Environment & "; dH range: " & sp("dHMax")
end if

if sp("DepthRangeShallow") <> "" then
	if sp("DepthRangeDeep") <> "" then
		Environment=Environment & "; depth range " & sp("DepthRangeShallow") & " - " & sp("DepthRangeDeep") & " m"
	else
		Environment=Environment & "; depth range - " & sp("DepthRangeShallow") & " m"
	end if
else
	if sp("DepthRangeDeep") <> "" then
		Environment=Environment & "; depth range - " & sp("DepthRangeDeep") & " m"
	end if
end if






'end of environment


'start of special char
dim vstockdefs, vauthor, vcomments
'distribution
vstockdefs	= ""
vstockdefs	= sp("stockdefs")
if len(vstockdefs) > 0 then
vstockdefs	= Replace(vstockdefs, "é","&#233;" )
vstockdefs	= Replace(vstockdefs, "ô","&#244;" )
vstockdefs	= Replace(vstockdefs, "ã","&#227;" )

vstockdefs	= Replace(vstockdefs, "&","&amp;" )

'vstockdefs	= Replace(vstockdefs, "<i>","<font><xsl:attribute name=""face"">verdana</xsl:attribute>" )
'vstockdefs	= Replace(vstockdefs, "</i>","</font>" )

'vstockdefs	= Replace(vstockdefs, ">","&#62;" )
vstockdefs	= Replace(vstockdefs, "°","&#176;" )
end if

'for biology
vcomments	=""
vcomments	=sp("comments")
if len(vcomments) > 0 then
	vcomments	=Replace(vcomments, "&","&#38;" )
	vcomments	=Replace(vcomments, "°","&#176;" )	
	'vcomments	=Replace(vcomments, " ","&#160;" )	
	'vcomments	=Replace(vcomments, "<i>","<emphasis>" )
	'vcomments	=Replace(vcomments, "</i>","</emphasis>" )
	'vcomments	= Replace(vcomments, "<i>","<a><xsl:attribute name=""href"">verdana</xsl:attribute>" )
	'vcomments	= Replace(vcomments, "</i>","</a>" )
	
end if
'for author
vauthor		=""
vauthor		=sp("author")
dim vcasrefno
vcasrefno=""
if len(vauthor) > 0 then
	vauthor		=Replace(vauthor, "å","&#229;" )
	vauthor		=Replace(vauthor, "ü","&#252;" )
	vauthor		=Replace(vauthor, "è","&#232;" )
	vauthor		=Replace(vauthor, "&","&amp;" )	
	
	

	set getCRN = conn.execute("SELECT SYNONYMS.CAS_REF_NO, SPECIES.SpecCode FROM SPECIES INNER JOIN SYNONYMS ON (SPECIES.Author = SYNONYMS.Author) AND (SPECIES.SpecCode = SYNONYMS.SpecCode) AND (SPECIES.Species = SYNONYMS.SynSpecies) AND (SPECIES.Genus = SYNONYMS.SynGenus) WHERE (((SPECIES.SpecCode)=" & vspeccode & "))")
	if not getCRN.eof then
		vcasrefno = getCRN("cas_ref_no")
	end if	
end if
'end of special char
'    <!ENTITY agrave  "&#224;" ><!-- small a, grave accent -->   
'    <!ENTITY aacute  "&#225;" ><!-- small a, acute accent -->
'    <!ENTITY acirc   "&#226;" ><!-- small a, circumflex accent -->
'    <!ENTITY atilde  "&#227;" ><!-- small a, tilde -->
'    <!ENTITY auml    "&#228;" ><!-- small a, dieresis or umlaut mark -->
'    <!ENTITY aring   "&#229;" ><!-- small a, ring -->
'    <!ENTITY egrave  "&#232;" ><!-- small e, grave accent -->
'    <!ENTITY eacute  "&#233;" ><!-- small e, acute accent | é -->
'    <!ENTITY ecirc   "&#234;" ><!-- small e, circumflex accent -->
'    <!ENTITY euml    "&#235;" ><!-- small e, dieresis or umlaut mark -->

'    <!ENTITY ugrave  "&#249;" ><!-- small u, grave accent -->
'    <!ENTITY uacute  "&#250;" ><!-- small u, acute accent -->
'    <!ENTITY ucirc   "&#251;" ><!-- small u, circumflex accent -->
'    <!ENTITY uuml    "&#252;" ><!-- small u, dieresis or umlaut mark -->

'start of maxsize
maxsize=""
if sp("length") <> "" then
	maxsize = sp("Length") & " cm " & sp("LTypeMaxM") & " (male/unsexed)"
end if
if sp("LengthFemale") <> "" then
	if maxsize  = "" then
		maxsize = sp("LengthFemale") & " cm " & sp("LTypeMaxF") & " (female)"
	else
		maxsize = maxsize & "; " & sp("LengthFemale") & " cm " & sp("LTypeMaxF") & " (female)"
	end if
end if
if sp("Weight") <> "" then
	if sp("weight") > 10000 then
		if maxsize  <> "" then
			maxsize= maxsize & "; max.weight: " & sp("Weight")/1000 & " kg"
		else
			maxsize=             "max.weight: " & sp("Weight")/1000 & " kg"
		end if
	else
		if maxsize  <> "" then
			maxsize= maxsize & "; max.weight: " & sp("Weight") & " g"
		else
			maxsize= "max.weight: " & sp("Weight") & " g"
		end if
	end if
end if
if sp("WeightFemale") <> "" then
	if sp("weightfemale") > 10000 then
		if sp("maxsize")  <> "" then
			maxsize= maxsize & "; max.weight: " & sp("WeightFemale")/1000 & " kg"
		else
			maxsize= "max.weight: " & sp("WeightFemale")/1000 & " kg"
		end if 
	else
		if maxsize  <> "" then
			maxsize= maxsize & "; max.weight: " & sp("WeightFemale") & " g"
		else
			maxsize= "max.weight: " & sp("WeightFemale") & " g"
		end if 
	end if 
end if 
if sp("longevitywild") > 0 then
	if maxsize  <> "" then
		MaxSize=MaxSize & "; max. reported age: " & sp("longevitywild") & " years"
	else
		MaxSize="max. reported age: " & sp("longevitywild") & " years"
	end if
end if
'end of maxsize
	sp.movenext 
	loop%><?xml version = "1.0" ?>
<?xml-stylesheet type="text/xsl" href="SpeciesSummary.xsl"?>
	<!-- 
		File Name: SpeciesSummary.xml 
				 : this is a partial xml document for the SpeciesSummary page
	-->	
<!DOCTYPE fishbase
[
	<!-- 
		 This is a DTD for the SpeciesSummary page 
	     and not the SPECIES table 
	-->	
<!ELEMENT fishbase (species,growth*)>
	<!ELEMENT species (speccode,genus,speciesfb,author,family,commonname,subfamily,order,class,fbname,distribution,diagnosis,biology,maxsize,environment,climate,importance,threatened,dangerous,coordinator,mainref,picname)>
		<!ELEMENT speccode (#PCDATA)>
		<!ELEMENT genus (#PCDATA)>
		<!ATTLIST genus
			link CDATA #IMPLIED
		>		
		<!ELEMENT speciesfb (#PCDATA)>
		<!ATTLIST speciesfb
			link CDATA #IMPLIED
		>		
		<!ELEMENT author (#PCDATA)>
		<!ATTLIST author
			casrefno CDATA #IMPLIED
			link CDATA #IMPLIED
		>
		<!ELEMENT family (#PCDATA)>
		<!ATTLIST family
			link CDATA #IMPLIED
		>		
		<!ELEMENT commonname (#PCDATA)>
		<!ELEMENT subfamily (#PCDATA)>
		<!ELEMENT order (#PCDATA)>
		<!ATTLIST order
			link CDATA #IMPLIED
		>		

		<!ELEMENT class (#PCDATA)>
		<!ELEMENT fbname (#PCDATA)>
		<!ELEMENT distribution (#PCDATA)>
		<!ELEMENT diagnosis ANY>
		<!ELEMENT biology (#PCDATA)>
		<!ELEMENT maxsize (#PCDATA)>
		<!ELEMENT environment (#PCDATA)>
		<!ELEMENT climate (#PCDATA)>
		<!ELEMENT importance (#PCDATA)>
		<!ELEMENT threatened (#PCDATA)>
		<!ELEMENT dangerous (#PCDATA)>
		<!ELEMENT coordinator (#PCDATA)>
		<!ATTLIST coordinator
			link CDATA #IMPLIED
		>		
		<!ELEMENT mainref (#PCDATA)>
		<!ATTLIST mainref 
			refnum CDATA #IMPLIED
			link CDATA #IMPLIED
		>
		<!ELEMENT picname EMPTY>
		<!ATTLIST picname 
			src CDATA #IMPLIED
			link CDATA #IMPLIED
			alt CDATA #IMPLIED
		>		

	<!ELEMENT growth (linf,type,K,to,sex,M,temp)>
		<!ELEMENT linf (#PCDATA)>
		<!ELEMENT type (#PCDATA)>
		<!ELEMENT K (#PCDATA)>
		<!ELEMENT to (#PCDATA)>
		<!ELEMENT sex (#PCDATA)>
		<!ELEMENT M (#PCDATA)>
		<!ELEMENT temp (#PCDATA)>
		
	<!ENTITY nbsp  " " >		
]
>
<fishbase>
<%
sp.movefirst
do while not sp.eof
%>
<species>
	<speccode><%=sp("speccode")%></speccode>	
	<genus 
		link="../Eschmeyer/GeneraSummary.cfm?ID=<%=sp("genus")%>" 
	><%=sp("genus")%></genus>					
	<speciesfb 
		link="../Eschmeyer/PiscesSummary.cfm?ID=<%=sp("speccode")%>" 
	><%=sp("species")%></speciesfb>			
	<author 
		casrefno="<%=vcasrefno%>"
		link="../Eschmeyer/EschmeyerSummary.cfm?RefNo=<%=vcasrefno%>" 
	><%=vauthor%></author>			
	<family 
		link="FamilySummary.cfm?ID=<%=sp("famcode")%>" 
	><%=sp("family")%></family>			
	<commonname><%=sp("commonname")%></commonname>
	<subfamily><%=sp("subfamily")%></subfamily>		
	<order 
		link="ordersSummary.cfm?order=<%=sp("order")%>" 
	><%=sp("order")%></order>	
	<class><%=sp("class")%></class>
	<fbname><%=sp("fbname")%></fbname>	
	<distribution><%=vstockdefs%></distribution>			
	<diagnosis><%=diagnosis%></diagnosis>	
	<biology><%=vcomments%></biology>		
	<maxsize><%=maxsize%></maxsize>	
	<environment><%=environment%></environment>	
	<climate><%=climate%></climate>	
	<importance><%=importance%></importance>	
	<threatened><%=threatened%></threatened>	
	<dangerous><%=sp("dangerous")%></dangerous>		
	<coordinator 
		link="../Collaborators/CollaboratorSummary.cfm?ID=<%=coordinator_id%>" 
	><%=coordinator%></coordinator>			
	<mainref 
		refnum="<%=refnum%>" 
		link="../References/FBRefSummary.cfm?ID=<%=refnum%>&#38;speccode=<%=sp("speccode")%>" 
	><%=mainref%></mainref>				
	<picname	
		src="<%=picname%>" 
		link="../Photos/ThumbnailsSummary.cfm?ID=<%=sp("speccode")%>"
		alt="Show available picture(s) for <%=sp("genus")%>&nbsp;<%=sp("species")%>"		
	/>	
</species>
<%sp.movenext 
loop %>
<% 
do while not gr.eof
%>
<growth>
	<linf><%=gr("loo")%></linf>
	<type><%=gr("type")%></type>
	<K><%=gr("K")%></K>
	<to><%=gr("to")%></to>
	<sex><%=gr("sex")%></sex>
	<M><%=gr("M")%></M>
	<temp><%=gr("temperature")%></temp>
</growth>
<%gr.movenext 
loop %>
<%gr.close %>
</fishbase>
<%sp.close%>

