<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"
    omit-xml-declaration="yes"
    indent="yes"
    encoding="UTF-8"
    doctype-public="-//W3C//DTD HTML 4.0//EN" />
    <xsl:template match="/">
        <html>
            <head>
                <link rel="stylesheet" href="/stationfinder/dhtml/css/stationfinder-popup-choosestation.css" type="text/css" />
            </head>
            <body>
		<script>parent.document.getElementById('panel').childNodes[2].childNodes[0].style.display = 'block';</script>
                <h1>Choose Your Local PBS Station</h1>
				<xsl:apply-templates select="stations"/>
            </body>
        </html>
    </xsl:template>

    <xsl:template match="stations">
        <xsl:variable name="zipcode"><xsl:value-of select="@zipcode" /></xsl:variable>
        <xsl:apply-templates select="station" />
    </xsl:template>

    <xsl:template match="station">
	<dl>
        <dt>
	    <a>
	    <xsl:attribute name="href">#</xsl:attribute>
		<xsl:attribute name="onclick">
                    parent.reloadWindow('<xsl:value-of select="@id" />', 'stationlogo', '<xsl:value-of select="$zipcode" />');
		</xsl:attribute>
		<xsl:attribute name="title">
			<xsl:value-of select="name" />
		</xsl:attribute>
                <img>
                    <xsl:attribute name="src">
                        <xsl:value-of select="image/url" />
                    </xsl:attribute>
                    <xsl:attribute name="width">
                        <xsl:value-of select="image/width" />
                    </xsl:attribute>
                    <xsl:attribute name="height">
                        <xsl:value-of select="image/height" />
                    </xsl:attribute>
                    <xsl:attribute name="alt">
                        <xsl:value-of select="name" />
                    </xsl:attribute>
                    <xsl:attribute name="title">
                        <xsl:value-of select="name" />
                    </xsl:attribute>
                </img>
		</a>
		<a>
	    <xsl:attribute name="href">#</xsl:attribute>
		<xsl:attribute name="onclick">
                    parent.reloadWindow('<xsl:value-of select="@id" />', 'stationtext', '<xsl:value-of select="$zipcode" />');
		</xsl:attribute>
		<xsl:attribute name="title">
			<xsl:value-of select="name" />
		</xsl:attribute>
            <xsl:value-of select="name" />
		</a>
		</dt>
		<dd><xsl:value-of select="location/city" />, <xsl:value-of select="location/state" /></dd>
	</dl>
    </xsl:template>
    <xsl:template match="error">
        <xsl:value-of select="msg" />
    </xsl:template>
</xsl:stylesheet>
