<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!-- xsl:comment>(c) 2000 Intuit Inc.  All Rights Reserved</xsl:comment -->

<xsl:template match="/">
<STYLE>
tr.choice { cursor:default }
td.mat { padding-left: 4pt; padding-bottom: 8pt }
</STYLE>

<xsl:choose>
	<xsl:when test="/STATUS/CODE"> 
		<xsl:call-template name="none"/>
	</xsl:when>
	<xsl:when test="//SONRS/STATUS/CODE[text()!=0]"> 
		<xsl:call-template name="error"/>
	</xsl:when>
	<xsl:when test="//SONRS/STATUS/CODE[text()=0]"> 
		<xsl:choose>
			<xsl:when test="count(//LOOKUPRSCOMPANY)=1">
				<xsl:call-template name="one"/>
			</xsl:when>
			<xsl:when test="count(//LOOKUPRSCOMPANY)>1">
				<xsl:call-template name="many"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:call-template name="none"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:when>
	<xsl:otherwise>
		<BODY>
			Unknown error!
		</BODY>
	</xsl:otherwise>
</xsl:choose>


</xsl:template>
<xsl:template name="error">
<BODY><H1>Error</H1></BODY>
</xsl:template>
<xsl:template name="none">
<TABLE cellpadding="0" cellspacing="0" border="0" width="100%">

	<TR>
		<TD height="18"></TD>
		<TD height="18"><B><font face="Arial" size="2" color="#006633">
          Company Not Found</font></B></TD>
	</TR>

	<TR>
		<TD height="8" colspan="2"><xsl:text>&#xA0;&#xA0;</xsl:text></TD>
	</TR>

	<TR>
		<TD height="21"></TD>
		<TD height="21"><font face="MS Sans Serif" size="1">There were
          no companies found in the D&amp;B database that 
		  matched the criteria you specified. Here are some possible reasons why:<br/><br/>
		  <UL>
			<LI>The data you entered is incorrect.</LI>
			<LI>The data you entered represents a consumer rather than a company.</LI>
			<LI>The data you entered may represent a company with no credit history or one that has never
				been reported to D&amp;B.</LI>
			</UL>
		  </font></TD>
	</TR>

	<TR>
		<TD height="21" width="10"></TD>
		<TD height="21"><font face="MS Sans Serif" size="1">
		Cannot find the company you are looking for? Try <a href="javascript:doAdvSearch()">advanced search</a>.<br/>
		</font></TD>
	</TR>

	<TR>
		<TD height="21"></TD>
		<TD height="21">
		  <input id="getsFocus" type="image" src="images/close_btn.gif" onClick="doCancelNone();"/></TD>
	</TR>

</TABLE>
</xsl:template>
<xsl:template name="one">
<TABLE cellpadding="0" cellspacing="0" border="0" width="100%">

	<TR>
		<TD height="18" width="10"></TD>
		<TD height="18" width="572" colspan="2"><B><font face="Arial" size="2" color="#006633">
          Company Found</font></B></TD>
	</TR>

	<TR>
		<TD height="8"  colspan="3"><xsl:text>&#xA0;&#xA0;</xsl:text></TD>
	</TR>

	<TR>
		<TD height="21" width="10"></TD>
		<TD height="21" width="572" colspan="2"><FONT face="MS Sans Serif" size="1">The
			company that you specified has been found in the D&amp;B 
			database. If this is the company that you were looking for,
			click Continue. If this is not the company that you were looking for, 
			<SPAN id="finishCode" finishCode="if (param('PassOn').indexOf('Origin:CredList')>=0) (document.all.credlist.style.display = 'inline') + 'x' + (document.all.notcredlist.style.display = 'none');" style="display: none"></SPAN>
			<SPAN id="notcredlist">click Cancel to start another search.</SPAN>
			<SPAN id="credlist" style="display:none">click Cancel to return to the Ongoing Alerts list</SPAN></FONT></TD>
	</TR>

	<TR>
		<TD height="21"  colspan="3"></TD>
	</TR>
	<TR>
		<TD height="21"></TD>
		<TD height="21" colspan="2"> 
			<xsl:value-of select="//NME"/><BR/>
			<xsl:value-of select="//ADR_LINE"/><BR/>
			<xsl:value-of select="//NON_POST_TOWN"/>,<xsl:text>&#xA0;</xsl:text><xsl:value-of select="//PRIM_GEO_AREA"/><xsl:text>&#xA0;&#xA0;</xsl:text><xsl:value-of select="//POST_CODE"/><BR/>
			Phone: 
			<xsl:choose>
			    <xsl:when test="//TLCM_NBR"> 
				<xsl:for-each select="//TLCM_NBR"> 
					(<xsl:value-of select="substring(text(),1,3)"/>)<xsl:value-of select="substring(text(),4,3)"/>-<xsl:value-of select="substring(text(),7,4)"/>
				</xsl:for-each>
			    </xsl:when>
			    <xsl:otherwise>
				n/a
			    </xsl:otherwise>
			</xsl:choose>
		</TD>
	</TR>

	<TR>
		<TD height="21" colspan="3"></TD>
	</TR>

	<TR>
		<TD colspan="3">
			<TABLE border="0"><TR>
				<TD height="21" width="10"></TD>
				<TD height="21" width="65"><input id="getsFocus" type="image" src="images/continue_btn.gif" onClick="doContinue1();"/></TD>
				<TD height="21" width="65"><input type="image" src="images/cancel_btn.gif" onClick="doCancel1();"/></TD>
			</TR></TABLE>
		</TD>
	</TR>

</TABLE>
<SPAN style="display: none">
	<SPAN id="companyParams" pname="DunsNum"><xsl:value-of select="//DUNS_NBR"/></SPAN>
	<SPAN id="companyParams" pname="dnbName"><xsl:value-of select="//NME"/></SPAN>
	<SPAN id="companyParams" pname="dnbStreet"><xsl:value-of select="//ADR_LINE"/></SPAN>
	<SPAN id="companyParams" pname="dnbCity"><xsl:value-of select="//NON_POST_TOWN"/></SPAN>
	<SPAN id="companyParams" pname="dnbState"><xsl:value-of select="//PRIM_GEO_AREA"/></SPAN>
	<SPAN id="companyParams" pname="dnbZip"><xsl:value-of select="//POST_CODE"/></SPAN>
	<SPAN id="companyParams" pname="dnbPhone"><xsl:value-of select="//TLCM_NBR"/></SPAN>
</SPAN>
</xsl:template>
<xsl:template name="many">

<SPAN id="finishCode" finishCode="doManyWork();" style="display: none"></SPAN>

<TABLE cellpadding="0" cellspacing="0" border="0" width="100%">

	<TR>
		<TD height="18" colspan="3">
		  <B>
		    <font face="Arial" size="2" color="#006633">
            Possible Matching Companies
			 </font>
		  </B>
		</TD>
	</TR>

	<TR>
		<TD height="8" colspan="3">
		  <xsl:text>&#xA0;&#xA0;</xsl:text>
		</TD>
	</TR>

	<TR>
		<TD height="18" width="10"></TD>
		<TD height="18" colspan="2">
        <font face="MS Sans Serif" size="1">
		    The company information that you specified:
		  </font>
		</TD>
	</TR>

	<TR>
		<TD height="18" width="10"><xsl:text>&#xA0;&#xA0;</xsl:text></TD>
		<TD height="18" colspan="2">
        <font face="MS Sans Serif" size="1">
		    <SPAN id="lookupInfo"></SPAN>
		    <SCRIPT><![CDATA[
			   document.write(XMLparam("PRIM_NME"));<BR/>
				al = XMLparam("ADR_LINE"); if (al!="") document.write(al + "<BR/>");
				pt = XMLparam("POST_TOWN"); if (pt!="") document.write(pt + ", ");
				document.write(XMLparam("PRIM_GEO_AREA"));
				pc = XMLparam("POST_CODE"); if (pc!="") document.write(" " + pc);
				ph = XMLparam("TLCM_NBR"); if (ph!="") document.write("Phone: " + ph + "<BR/>");
          ]]></SCRIPT>
        </font>
		</TD>
	</TR>

	<TR>
		<TD height="18" width="10"></TD>
		<TD height="18" colspan="2"></TD>
	</TR>

	<TR>
		<TD height="18" width="10"></TD>
		<TD height="18" colspan="2"><font face="MS Sans Serif" size="1">
	  The following are possible matches in the D&amp;B database
          for the company that you specified.<br/>
	  
	  Select one of the following companies and click Continue.<br/><xsl:text>&#xA0;</xsl:text></font></TD>
	</TR>

	<xsl:apply-templates select="//DGX/CREDITMSGSRSV2/LOOKUPTRNRS/LOOKUPRS/LOOKUPRSCOMPANY"/>	

	<TR class="choice" onclick="select(this);" onmouseout="rolloff(this);" onmouseover="rollon(this);">
		<TD height="18" width="10"></TD>
		<TD height="18" width="42" valign="top" class="mat"><input name="xradio" id="noneradio" type="radio"/></TD>
		<TD height="18" width="100%" class="mat"><font face="MS Sans Serif" size="1">None</font></TD>	
	</TR>

	<TR>
		<TD height="21" width="584" colspan="3"></TD>
	</TR>

	<TR>
		<TD height="21" width="10"></TD>
		<TD height="21" colspan="2"><font face="MS Sans Serif" size="1">
		Cannot find the company you are looking for? Try <a href="javascript:doAdvSearch()">advanced search</a>.<br/>
		</font></TD>
	</TR>

	<TR><TD colspan="3"><TABLE border="0"><TR>
		<TD height="21" width="10"></TD>
		<TD height="21" width="65"><input id="getsFocus" type="image" src="images/continue_btn.gif" onClick="doContinueMany();"/></TD>
		<TD height="21" width="65"><input type="image" src="images/cancel_btn.gif" onClick="doCancelMany();"/></TD>
		</TR></TABLE></TD>
	</TR>

</TABLE>
</xsl:template>

<xsl:template match="//DGX/CREDITMSGSRSV2/LOOKUPTRNRS/LOOKUPRS/LOOKUPRSCOMPANY">
	<TR class="choice" onclick="select(this);" onmouseout="rolloff(this);" onmouseover="rollon(this);">
	<TD height="21" width="10"></TD>
	<TD valign="top" class="mat">
		<INPUT name="xradio" id="xradio" type="radio"/>
		<SPAN style="display: none">
			<SPAN id="companyParams" pname="DunsNum"><xsl:value-of select="DUNS_NBR"/></SPAN>
			<SPAN id="companyParams" pname="dnbName"><xsl:value-of select="NME"/></SPAN>
			<SPAN id="companyParams" pname="dnbStreet"><xsl:value-of select="ADR_LINE"/></SPAN>
			<SPAN id="companyParams" pname="dnbCity"><xsl:value-of select="NON_POST_TOWN"/></SPAN>
			<SPAN id="companyParams" pname="dnbState"><xsl:value-of select="PRIM_GEO_AREA"/></SPAN>
			<SPAN id="companyParams" pname="dnbZip"><xsl:value-of select="POST_CODE"/></SPAN>
			<SPAN id="companyParams" pname="dnbPhone"><xsl:value-of select="TLCM_NBR"/></SPAN>
		</SPAN>
	</TD>
	<TD class="mat"><FONT face="MS Sans Serif" size="1">
	<xsl:value-of select="NME"/><BR/>
	<xsl:value-of select="ADR_LINE"/>,<xsl:text>&#xA0;</xsl:text>
	<xsl:value-of select="NON_POST_TOWN"/>,<xsl:text>&#xA0;</xsl:text>
	<xsl:value-of select="PRIM_GEO_AREA"/> <xsl:text>&#xA0;&#xA0;</xsl:text>
	<xsl:value-of select="POST_CODE"/><BR/>
	Phone: 
	<xsl:choose>
	    <xsl:when test="TLCM_NBR"> 
		<xsl:for-each select="TLCM_NBR"> 
			(<xsl:value-of select="substring(text(),1,3)"/>)<xsl:value-of select="substring(text(),4,3)"/>-<xsl:value-of select="substring(text(),7,4)"/>
		</xsl:for-each>
	    </xsl:when>
	    <xsl:otherwise>
		n/a
	    </xsl:otherwise>
	</xsl:choose>
	</FONT>
	</TD></TR>
	<TR><TD style="height: 8px"></TD>
	</TR>
</xsl:template>

</xsl:stylesheet>