<xsl:stylesheet version="1.0"	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                                xmlns:str="http://exslt.org/strings"
                                extension-element-prefixes="str">
                                
<xsl:import href="ppp/str.xsl" />

<xsl:output method="xml" omit-xml-declaration="yes"/>

  <xsl:template name="videoSource">
    <xsl:variable name="tmp">
      <xsl:choose>
        <xsl:when test="contains(videoSource,'DVDSCR')">source_dvdscr.png</xsl:when>
        <xsl:when test="contains(videoSource,'R5')">source_r5.png</xsl:when>
        <xsl:when test="contains(videoSource,'BluRay')">source_bluray.png</xsl:when>
        <xsl:when test="contains(videoSource,'HDDVD')">source_hddvd.png</xsl:when>
        <xsl:when test="contains(videoSource,'DVD')">source_dvd.png</xsl:when>
        <xsl:when test="contains(videoSource,'HDTV')">source_hdtv.png</xsl:when>
        <xsl:when test="contains(videoSource,'UNKNOWN')">unknownvideo.png</xsl:when>
        <xsl:when test="contains(videoSource,'CAM')">source_cam.png</xsl:when>
        <xsl:when test="contains(videoSource,'TS')">source_telecine.png</xsl:when>
        <xsl:when test="contains(videoSource,'D-THEATER')">source_dtheater</xsl:when>
        <xsl:when test="contains(videoSource,'WEBDL')">source_webdl.png</xsl:when>
        <xsl:when test="contains(videoSource,'SDTV')">source_sdtv.png</xsl:when>
        <xsl:otherwise>unknownvideo.png</xsl:otherwise> 
      </xsl:choose>
    </xsl:variable>
    <img><xsl:attribute name="src"><xsl:value-of select="concat('pictures/flags/', $tmp)" /></xsl:attribute></img>
  </xsl:template>
 
  <xsl:template name="container">
    <xsl:variable name="tmp">
      <xsl:choose>
        <xsl:when test="contains(container,'ASF')">asf.png</xsl:when>
        <xsl:when test="contains(container,'AVI')">avi.png</xsl:when>
        <xsl:when test="contains(container,'BIN')">bin.png</xsl:when>
        <xsl:when test="contains(container,'DAT')">dat.png</xsl:when>
        <xsl:when test="contains(container,'DIVX')">divx.png</xsl:when>
        <xsl:when test="contains(container,'DVD')">dvd.png</xsl:when>
        <xsl:when test="contains(container,'IMG')">img.png</xsl:when>
        <xsl:when test="contains(container,'ISO')">iso.png</xsl:when>
        <xsl:when test="contains(container,'M1V')">m1v.png</xsl:when>
        <xsl:when test="contains(container,'M2P')">m2p.png</xsl:when>
        <xsl:when test="contains(container,'M2T')">m2t.png</xsl:when>
        <xsl:when test="contains(container,'M2TS') or contains(container,'BDAV') or contains(container,'BluRay')">m2ts.png</xsl:when>
        <xsl:when test="contains(container,'M2V')">m2v.png</xsl:when>
        <xsl:when test="contains(container,'M4V')">m4v.png</xsl:when>
        <xsl:when test="contains(container,'MDF')">mdf.png</xsl:when>
        <xsl:when test="contains(container,'MKV') or contains(container,'Matroska')">mkv.png</xsl:when>
        <xsl:when test="contains(container,'MOV')">mov.png</xsl:when>
        <xsl:when test="contains(container,'MP4') or contains(container,'MPEG-4')">mp4.png</xsl:when>
        <xsl:when test="contains(container,'MPG') or contains(container,'PS')">mpg.png</xsl:when>
        <xsl:when test="contains(container,'MTS')">mts.png</xsl:when>
        <xsl:when test="contains(container,'NRG')">nrg.png</xsl:when>
        <xsl:when test="contains(container,'QT')">qt.png</xsl:when>
        <xsl:when test="contains(container,'RAR')">rar.png</xsl:when>
        <xsl:when test="contains(container,'RM')">rm.png</xsl:when>
        <xsl:when test="contains(container,'RMP4')">rmp4.png</xsl:when>
        <xsl:when test="contains(container,'TP')">tp.png</xsl:when>
        <xsl:when test="contains(container,'TRP')">trp.png</xsl:when>
        <xsl:when test="contains(container,'TS')">ts.png</xsl:when>
        <xsl:when test="contains(container,'VOB')">vob.png</xsl:when>
        <xsl:when test="contains(container,'WMV') or contains(container,'Windows Media')">wmv.png</xsl:when>
        <xsl:otherwise>unknown.png</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <img><xsl:attribute name="src"><xsl:value-of select="concat('pictures/flags/container_', $tmp)" /></xsl:attribute></img>
  </xsl:template>
 
  <xsl:template name="alaskavideoSource">
    <xsl:variable name="tmp">
      <xsl:choose>
        <xsl:when test="contains(videoSource,'DVDSCR')">source_dvdscr.png</xsl:when>
        <xsl:when test="contains(videoSource,'R5')">source_r5.png</xsl:when>
        <xsl:when test="contains(videoSource,'BluRay')">source_bluray.png</xsl:when>
        <xsl:when test="contains(videoSource,'HDDVD')">source_hddvd.png</xsl:when>
        <xsl:when test="contains(videoSource,'DVD')">source_dvd.png</xsl:when>
        <xsl:when test="contains(videoSource,'HDTV')">source_hdtv.png</xsl:when>
        <xsl:when test="contains(videoSource,'CAM')">source_cam.png</xsl:when>
        <xsl:when test="contains(videoSource,'TS')">source_telecine.png</xsl:when>
        <xsl:when test="contains(videoSource,'UNKNOWN')">unknownvideo.png</xsl:when>
        <xsl:otherwise>unknownvideo.png</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <img width="59"><xsl:attribute name="src"><xsl:value-of select="concat('pictures/flags/', $tmp)" /></xsl:attribute></img>
  </xsl:template>

  <xsl:template name="subtitles">
    <xsl:variable name="tmp">
      <xsl:choose>
        <xsl:when test="contains(subtitles,'NO')">cc-off.png</xsl:when>
        <xsl:otherwise>cc.png</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <img><xsl:attribute name="src"><xsl:value-of select="concat('pictures/detail/', $tmp)" /></xsl:attribute></img>
  </xsl:template>

  <xsl:template name="videoCodec">
    <xsl:variable name="tmp">
      <xsl:choose>
        <xsl:when test="contains(videoCodec,'AVC') or contains(videoCodec,'avc1')
            or contains(videoCodec,'264')">codec_h264.png</xsl:when>
        <xsl:when test="contains(videoCodec,'XviD')">codec_xvid.png</xsl:when>
        <xsl:when test="contains(videoCodec,'DivX')">codec_divx.png</xsl:when>
        <xsl:when test="contains(videoCodec,'MPEG')">codec_mpeg.png</xsl:when>
        <xsl:when test="contains(videoCodec,'icrosoft') or contains(videoCodec,'MICROSOFT')
            or contains(videoCodec,'VC-1')">codec_ms.png</xsl:when>
        <xsl:otherwise>unknownvideo.png</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <img><xsl:attribute name="src"><xsl:value-of select="concat('pictures/flags/', $tmp)" /></xsl:attribute></img>
 </xsl:template>

  <xsl:template name="videoOutput">
    <xsl:variable name="tmp">
      <xsl:choose>
        <xsl:when test="contains(videoOutput,'720p')">output_720p.png</xsl:when>
        <xsl:when test="contains(videoOutput,'1080p')">output_1080p.png</xsl:when>
        <xsl:when test="contains(videoOutput,'1080')">output_1080i.png</xsl:when>
        <xsl:when test="contains(videoOutput,'NTSC') or contains(videoOutput,'24p')">output_ntsc.png</xsl:when>
        <xsl:when test="contains(videoOutput,'PAL')">output_pal.png</xsl:when>
        <xsl:when test="contains(videoOutput,'480i')">output_480i.png</xsl:when>
        <xsl:when test="contains(videoOutput,'480p')">output_480p.png</xsl:when>
        <xsl:when test="contains(videoOutput,'576i')">output_576i.png</xsl:when>
        <xsl:when test="contains(videoOutput,'SDTV')">output_sdtv.png</xsl:when>
        <xsl:otherwise>unknownvideo.png</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <img><xsl:attribute name="src"><xsl:value-of select="concat('pictures/flags/', $tmp)" /></xsl:attribute></img>
  </xsl:template>
 
  <xsl:template name="alaskavideoOutput">
    <xsl:choose>
      <xsl:when test="contains(videoOutput,'720p')">720</xsl:when>
      <xsl:when test="contains(videoOutput,'1080')">1080</xsl:when>
      <xsl:when test="contains(videoOutput,'NTSC') or contains(videoOutput,'24p')">NTSC</xsl:when>
      <xsl:when test="contains(videoOutput,'PAL')">PAL</xsl:when>
      <xsl:otherwise>?</xsl:otherwise>
    </xsl:choose>
  </xsl:template>
 
  <xsl:template name="framerate">
    <xsl:variable name="tmp">
      <xsl:choose>
        <xsl:when test="contains(fps,'23.976')">fps_23976.png</xsl:when>
        <xsl:when test="contains(fps,'24')">fps_24.png</xsl:when>
        <xsl:when test="contains(fps,'25')">fps_25.png</xsl:when>
        <xsl:when test="contains(fps,'29.97')">fps_2997.png</xsl:when>
        <xsl:when test="contains(fps,'30')">fps_30.png</xsl:when>
        <xsl:when test="contains(fps,'50')">fps_50.png</xsl:when>
        <xsl:when test="contains(fps,'59')">fps_59.png</xsl:when>
        <xsl:when test="contains(fps,'59.94')">fps_5994.png</xsl:when>
        <xsl:when test="contains(fps,'60')">fps_60.png</xsl:when>
        <xsl:otherwise>unknownvideo.png</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <img><xsl:attribute name="src"><xsl:value-of select="concat('pictures/flags/', $tmp)" /></xsl:attribute></img>
  </xsl:template>

  <xsl:template name="aspectratio">
    <xsl:variable name="aspectratio" select="substring-before(aspect,':')"/>
    <xsl:variable name="tmp">
      <xsl:choose>
        <xsl:when test="$aspectratio &gt;= 1.000 and $aspectratio &lt; 1.350">ar_133.png</xsl:when>
        <xsl:when test="$aspectratio &gt;= 1.350 and $aspectratio &lt; 1.400">ar_137.png</xsl:when>
        <xsl:when test="$aspectratio &gt;= 1.400 and $aspectratio &lt; 1.465">ar_143.png</xsl:when>
        <xsl:when test="$aspectratio &gt;= 1.465 and $aspectratio &lt; 1.530">ar_150.png</xsl:when>
        <xsl:when test="$aspectratio &gt;= 1.530 and $aspectratio &lt; 1.610">ar_156.png</xsl:when>
        <xsl:when test="$aspectratio &gt;= 1.610 and $aspectratio &lt; 1.705">ar_166.png</xsl:when>
        <xsl:when test="$aspectratio &gt;= 1.705 and $aspectratio &lt; 1.765">ar_175.png</xsl:when>
        <xsl:when test="$aspectratio &gt;= 1.765 and $aspectratio &lt; 1.815">ar_178.png</xsl:when>
        <xsl:when test="$aspectratio &gt;= 1.815 and $aspectratio &lt; 1.925">ar_185.png</xsl:when>
        <xsl:when test="$aspectratio &gt;= 1.925 and $aspectratio &lt; 2.100">ar_200.png</xsl:when>
        <xsl:when test="$aspectratio &gt;= 2.100 and $aspectratio &lt; 2.275">ar_220.png</xsl:when>
        <xsl:when test="$aspectratio &gt;= 2.275 and $aspectratio &lt; 2.370">ar_235.png</xsl:when>
        <xsl:when test="$aspectratio &gt;= 2.370 and $aspectratio &lt; 2.395">ar_239.png</xsl:when>
        <xsl:when test="$aspectratio &gt;= 2.395 and $aspectratio &lt; 2.405">ar_240.png</xsl:when>
        <xsl:when test="$aspectratio &gt;= 2.405 and $aspectratio &lt; 2.415">ar_241.png</xsl:when>
        <xsl:when test="$aspectratio &gt;= 2.415 and $aspectratio &lt; 2.485">ar_242.png</xsl:when>
        <xsl:when test="$aspectratio &gt;= 2.485 and $aspectratio &lt; 2.570">ar_255.png</xsl:when>
        <xsl:when test="$aspectratio &gt;= 2.570 and $aspectratio &lt; 2.625">ar_259.png</xsl:when>
        <xsl:when test="$aspectratio &gt;= 2.625 and $aspectratio &lt; 2.710">ar_266.png</xsl:when>
        <xsl:when test="$aspectratio &gt;= 2.710 and $aspectratio &lt; 3.001">ar_276.png</xsl:when>
		<xsl:when test="$aspectratio = 3">ar_150.png</xsl:when><!--3:2-->
		<xsl:when test="$aspectratio = 4">ar_133.png</xsl:when><!--4:3-->
		<xsl:when test="$aspectratio = 16">ar_178.png</xsl:when><!--16:9-->
        <xsl:otherwise>unknownvideo.png</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <img><xsl:attribute name="src"><xsl:value-of select="concat('pictures/flags/', $tmp)" /></xsl:attribute></img>
  </xsl:template>

  <xsl:template name="audioCodec">
    <xsl:variable name="parsedAudioCodec" select="tokenize(//details/movie/audioCodec,' / ')"/>
    <xsl:variable name="parsedAudioChannels" select="tokenize(//details/movie/audioChannels,' / ')"/>

    <xsl:variable name="pass" select="position()" />
    <xsl:if test="$pass!=1"><img src="pictures/Dot.png" /></xsl:if>

    <xsl:variable name="tmp">
      <xsl:choose>
        <xsl:when test="contains($parsedAudioCodec[$pass],'AC3')">audcod_dolby.png</xsl:when>
        <xsl:when test="contains($parsedAudioCodec[$pass],'TrueHD')">audcod_truehd.png</xsl:when>
        <xsl:when test="contains($parsedAudioCodec[$pass],'DTS-HD')">audcod_dtshd.png</xsl:when>
        <xsl:when test="contains($parsedAudioCodec[$pass],'DTS')">audcod_dts.png</xsl:when>
        <xsl:when test="contains($parsedAudioCodec[$pass],'MP3')">audcod_mp3.png</xsl:when>
        <xsl:when test="contains($parsedAudioCodec[$pass],'AAC')">audcod_aac.png</xsl:when>
        <xsl:when test="contains($parsedAudioCodec[$pass],'VORBIS') or contains($parsedAudioCodec[$pass],'orbis')">audcod_ogg.png</xsl:when>
        <xsl:when test="contains($parsedAudioCodec[$pass],'A_FLAC')">audcod_flac.png</xsl:when>
        <xsl:when test="contains($parsedAudioCodec[$pass],'QDM2') or contains($parsedAudioCodec[$pass],'QDMC')">audcod_q.png</xsl:when>
        <xsl:when test="contains($parsedAudioCodec[$pass],'MICROSOFT')
            or contains($parsedAudioCodec[$pass],'icrosoft') or contains($parsedAudioCodec[$pass],'162')
            or contains($parsedAudioCodec[$pass],'VC-1')">codec_ms.png</xsl:when>
        <xsl:when test="contains($parsedAudioCodec[$pass],'PCM')">audcod_pcm.png</xsl:when>
		<xsl:when test="contains($parsedAudioCodec[$pass],'MPA1L2') or contains($parsedAudioCodec[$pass],'MPEG-1A')">audcod_mpa.png</xsl:when>
        <xsl:otherwise>unknownaudio.png</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <img align="top">
      <xsl:attribute name="src"><xsl:value-of select="concat('pictures/flags/', $tmp)" /></xsl:attribute>
    </img>

    <xsl:if test="$LowList='true'">&#160;</xsl:if>
    <xsl:variable name="tmp">
      <xsl:choose>
        <xsl:when test="$parsedAudioChannels[$pass]=6">audch_51.png</xsl:when>
        <xsl:when test="$parsedAudioChannels[$pass]=8">audch_71.png</xsl:when>
        <xsl:when test="$parsedAudioChannels[$pass]=2">audch_20.png</xsl:when>
        <xsl:when test="$parsedAudioChannels[$pass]=3">audch_21.png</xsl:when>
        <xsl:when test="$parsedAudioChannels[$pass]=7">audch_61.png</xsl:when>
        <xsl:otherwise>../1x1.png</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:if test="$tmp">
      <img align="top">
        <xsl:attribute name="src"><xsl:value-of select="concat('pictures/flags/', $tmp)" /></xsl:attribute>
      </img>
    </xsl:if>
  </xsl:template>

  <xsl:template name="AudioLanguages">
    <xsl:variable name="parsedAudioCodec" select="tokenize(//details/movie/audioCodec,' / ')"/>
      
    <xsl:if test="count($parsedAudioCodec) &gt; 2">
      <xsl:value-of select="count($parsedAudioCodec)"/>
    </xsl:if>
    <img src="pictures/lowlist/multiaudio.png">
      <xsl:if test="$dim='true'"><xsl:attribute name="height">24</xsl:attribute></xsl:if>
      <xsl:if test="$dim='false'"><xsl:attribute name="height">35</xsl:attribute></xsl:if>
    </img>

    <xsl:for-each select="$parsedAudioCodec[position() &lt;= 2]">
      <xsl:variable name="pass" select="position()" />
      <xsl:if test="$pass!=1">/</xsl:if>

      <xsl:if test="contains($parsedAudioCodec,'(')">
        <xsl:variable name="langAfter" select="substring-after($parsedAudioCodec[$pass],'(')"/>
        <xsl:variable name="langBefore" select="substring-before($langAfter,')')"/>
        <xsl:value-of select="$langBefore"/>
      </xsl:if>
    </xsl:for-each>

    <xsl:if test="$parsedAudioCodec[position() = 3] != ''">/...</xsl:if>
  </xsl:template>

  <xsl:template name="alaskaaudioCodec">
    <xsl:variable name="parsedAudioCodec" select="tokenize(//details/movie/audioCodec,' / ')"/>
    <xsl:variable name="parsedAudioChannels" select="tokenize(//details/movie/audioChannels,' / ')"/>
    <xsl:variable name="pass" select="position()" />

    <td background="pictures/alaska/flags/audcod-frame.png" width="59" align="center">
      <xsl:variable name="tmp">
        <xsl:choose>
          <xsl:when test="contains($parsedAudioCodec[$pass],'AC3')">audcod_dolby.png</xsl:when>
          <xsl:when test="contains($parsedAudioCodec[$pass],'TrueHD')">audcod_truehd.png</xsl:when>
          <xsl:when test="contains($parsedAudioCodec[$pass],'DTS-HD')">audcod_dtshd.png</xsl:when>
          <xsl:when test="contains($parsedAudioCodec[$pass],'DTS')">audcod_dts.png</xsl:when>
          <xsl:when test="contains($parsedAudioCodec[$pass],'MP3')">audcod_mp3.png</xsl:when>
          <xsl:when test="contains($parsedAudioCodec[$pass],'AAC')">audcod_aac.png</xsl:when>
          <xsl:when test="contains($parsedAudioCodec[$pass],'VORBIS') or contains($parsedAudioCodec[$pass],'orbis')">audcod_ogg.png</xsl:when>
          <xsl:when test="contains($parsedAudioCodec[$pass],'A_FLAC')">audcod_flac.png</xsl:when>
          <xsl:when test="contains($parsedAudioCodec[$pass],'QDM2') or contains($parsedAudioCodec[$pass],'QDMC')">audcod_q.png</xsl:when>
          <xsl:when test="contains($parsedAudioCodec[$pass],'MICROSOFT')
              or contains($parsedAudioCodec[$pass],'icrosoft') or contains($parsedAudioCodec[$pass],'162')
              or contains($parsedAudioCodec[$pass],'VC-1')">codec_ms.png</xsl:when>
          <xsl:when test="contains($parsedAudioCodec[$pass],'PCM')">audcod_pcm.png</xsl:when>
          <xsl:otherwise>unknownaudio.png</xsl:otherwise>
        </xsl:choose>
      </xsl:variable>
      <img align="top" height="22">
        <xsl:attribute name="src"><xsl:value-of select="concat('pictures/flags/', $tmp)" /></xsl:attribute>
      </img>
    </td><td background="pictures/alaska/flags/audch.png" width="25" class="alaska-flags" align="center">
      <xsl:choose>
        <xsl:when test="$parsedAudioChannels[$pass]=6">5.1</xsl:when>
        <xsl:when test="$parsedAudioChannels[$pass]=8">7.1</xsl:when>
        <xsl:when test="$parsedAudioChannels[$pass]=2">2.0</xsl:when>
        <xsl:when test="$parsedAudioChannels[$pass]=3">2.1</xsl:when>
        <xsl:when test="$parsedAudioChannels[$pass]=7">6.1</xsl:when>
        <xsl:otherwise></xsl:otherwise>
      </xsl:choose>
    </td>
  </xsl:template>

  <xsl:template name="extras">
    <xsl:for-each select="extras/extra">
      <div class="link">
        <a>
          <xsl:attribute name="href"><xsl:value-of select="." /></xsl:attribute>
          <xsl:if test="substring(.,string-length(.)-7) = 'VIDEO_TS'
              or substring(.,string-length(.)-2) = 'ISO' or substring(.,string-length(.)-2) = 'iso' 
              or substring(.,string-length(.)-2) = 'IMG' or substring(.,string-length(.)-2) = 'img' ">
            <xsl:attribute name="zcd">2</xsl:attribute>
          </xsl:if>
          <xsl:attribute name="vod"/>
          <xsl:attribute name="onkeyupset">Play</xsl:attribute>

          <xsl:variable name="tmp">
            <xsl:choose>
              <xsl:when test="contains(@title,'hort')">Short</xsl:when>
              <xsl:when test="contains(@title,'onus')">Bonus</xsl:when>
              <xsl:when test="contains(.,'clip')">Clip</xsl:when>
              <xsl:when test="contains(.,'30sec')">30sec</xsl:when>
              <xsl:when test="contains(.,'tsr')">Teaser</xsl:when>
              <xsl:when test="contains(.,'tlr') or contains(@title,'railer') or @title = 'TRAILER'">Trailer</xsl:when>
              <xsl:otherwise>Extra</xsl:otherwise>
            </xsl:choose>
          </xsl:variable>
          <img align="top">
            <xsl:attribute name="src"><xsl:value-of select="concat(concat('pictures/', $tmp), '.png')" /></xsl:attribute>
            <xsl:attribute name="onMouseOver"><xsl:value-of select="this.src=concat(concat('pictures/', $tmp), 'Select.png')" /></xsl:attribute>
            <xsl:attribute name="onMouseOut"><xsl:value-of select="this.src=concat(concat('pictures/', $tmp), '.png')" /></xsl:attribute>
            <xsl:attribute name="onfocussrc"><xsl:value-of select="concat(concat('pictures/', $tmp), 'Select.png')" /></xsl:attribute>
          </img>
        </a>

        <xsl:choose>
          <xsl:when test="contains(@title,'TRAILER')">
            <xsl:variable name="trlrafter" select="substring-after(.,'TRAILER%5D.')"/>
            <xsl:variable name="trlrbefore" select="substring-before($trlrafter,'.mov')"/>
            <xsl:value-of select="$trlrbefore"/>
          </xsl:when>
          <xsl:when test="contains(@title,'Extra - ')">
            <xsl:variable name="titleAfter" select="substring-after(@title,'Extra - ')"/>
            <xsl:value-of select="$titleAfter"/>
          </xsl:when>
          <xsl:when test="contains(@title,'Extra-')">
            <xsl:variable name="titleAfter" select="substring-after(@title,'Extra-')"/>
            <xsl:value-of select="$titleAfter"/>
          </xsl:when>
          <xsl:when test="contains(@title,'Short - ')">
            <xsl:variable name="titleAfter" select="substring-after(@title,'Short - ')"/>
            <xsl:value-of select="$titleAfter"/>
          </xsl:when>
          <xsl:when test="contains(@title,'Short-')">
            <xsl:variable name="titleAfter" select="substring-after(@title,'Short-')"/>
            <xsl:value-of select="$titleAfter"/>
          </xsl:when>
          <xsl:when test="contains(@title,'Bonus - ')">
            <xsl:variable name="titleAfter" select="substring-after(@title,'Bonus - ')"/>
            <xsl:value-of select="$titleAfter"/>
          </xsl:when>
          <xsl:when test="contains(@title,'Bonus-')">
            <xsl:variable name="titleAfter" select="substring-after(@title,'Bonus-')"/>
            <xsl:value-of select="$titleAfter"/>
          </xsl:when>
          <xsl:when test="contains(@title,'Trailer - ')">
            <xsl:variable name="titleAfter" select="substring-after(@title,'Trailer - ')"/>
            <xsl:value-of select="$titleAfter"/>
          </xsl:when>
          <xsl:when test="contains(@title,'Trailer-')">
            <xsl:variable name="titleAfter" select="substring-after(@title,'Trailer-')"/>
            <xsl:value-of select="$titleAfter"/>
          </xsl:when>
          <xsl:otherwise><xsl:value-of select="@title"/></xsl:otherwise>
        </xsl:choose>
      </div>
    </xsl:for-each>
  </xsl:template>

  <xsl:template name="playsing">
    <a class="link">
      <xsl:attribute name="href"><xsl:value-of select="//files/file/fileURL" /></xsl:attribute>
      <xsl:if test="substring(//files/file/fileURL,string-length(//files/file/fileURL)-3,4) = '.ISO'
            or substring(//files/file/fileURL,string-length(//files/file/fileURL)-3,4) = '.iso'
            or substring(//files/file/fileURL,string-length(//files/file/fileURL)-3,4) = '.IMG'
            or substring(//files/file/fileURL,string-length(//files/file/fileURL)-3,4) = '.img'
            or substring(//files/file/fileURL,string-length(//files/file/fileURL)-7,8) = 'VIDEO_TS'">
        <xsl:attribute name="zcd">2</xsl:attribute>
      </xsl:if>
      <xsl:attribute name="vod"/>
      <xsl:attribute name="TVID">Play</xsl:attribute>
      <xsl:attribute name="name">Play</xsl:attribute>
      <xsl:if test="//movie/prebuf != '-1'">
        <xsl:attribute name="prebuf"><xsl:value-of select="//movie/prebuf" /></xsl:attribute>
      </xsl:if>
      <img src="pictures/MainNavCenter.png">
        <xsl:attribute name="onmouseover">this.src='pictures/MainNavCenterSelect.png'</xsl:attribute>
        <xsl:attribute name="onmouseout">this.src='pictures/MainNavCenter.png'</xsl:attribute>
        <xsl:attribute name="onfocussrc">pictures/MainNavCenterSelect.png</xsl:attribute>
      </img>
    </a>
  </xsl:template>

  <xsl:template name="playmult">
    <a class="link">
      <xsl:attribute name="href"><xsl:value-of select="concat(/details/movie/baseFilename,'.playlist.jsp')" /></xsl:attribute>
      <xsl:attribute name="vod">playlist</xsl:attribute>
      <xsl:attribute name="TVID">Play</xsl:attribute>
      <xsl:attribute name="name">Play</xsl:attribute>
      <xsl:if test="//movie/prebuf != '-1'">
        <xsl:attribute name="prebuf"><xsl:value-of select="//movie/prebuf" /></xsl:attribute>
      </xsl:if>
      <img src="pictures/MainNavCenter.png">
        <xsl:attribute name="onmouseover">this.src='pictures/MainNavCenterSelect.png'</xsl:attribute>
        <xsl:attribute name="onmouseout">this.src='pictures/MainNavCenter.png'</xsl:attribute>
        <xsl:attribute name="onfocussrc">pictures/MainNavCenterSelect.png</xsl:attribute>
      </img>
    </a>
  </xsl:template>
 
  <xsl:template name="certification">
    <xsl:variable name="tmp">
	<xsl:choose>
		<xsl:when test="/details/movie/certification = 'R' and $imdb.preferredCountry='Australia'">oflc_r.png</xsl:when>
		<xsl:when test="/details/movie/certification = 'R' and $imdb.preferredCountry!='Australia'">mpaa_r.png</xsl:when>
		<xsl:when test="/details/movie/certification = 'PG' and $imdb.preferredCountry='UK'">bbfc_pg.png</xsl:when>
		<xsl:when test="/details/movie/certification = 'PG' and $imdb.preferredCountry='Australia'">oflc_pg.png</xsl:when>
		<xsl:when test="/details/movie/certification = 'PG' and $imdb.preferredCountry!='UK' and $imdb.preferredCountry!='Australia'">mpaa_pg.png</xsl:when>
        <xsl:when test="/details/movie/certification = 'PG-13'">mpaa_pg13.png</xsl:when>
		<xsl:when test="/details/movie/certification = 'G' and $imdb.preferredCountry='Australia'">oflc_g.png</xsl:when>
		<xsl:when test="/details/movie/certification = 'G' and $imdb.preferredCountry!='Australia'">mpaa_g.png</xsl:when>
        <xsl:when test="/details/movie/certification = 'NC-17'">mpaa_nc17.png</xsl:when>
        <xsl:when test="/details/movie/certification = 'TV-14'">tv_14.png</xsl:when>
        <xsl:when test="/details/movie/certification = 'TV-G'">tv_g.png</xsl:when>
        <xsl:when test="/details/movie/certification = 'TV-MA'">tv_ma.png</xsl:when>
        <xsl:when test="/details/movie/certification = 'TV-PG'">tv_pg.png</xsl:when>
        <xsl:when test="/details/movie/certification = 'TV-Y'">tv_y.png</xsl:when>
        <xsl:when test="/details/movie/certification = 'TV-Y7'">tv_y7.png</xsl:when>
        <xsl:when test="/details/movie/certification = 'TV-Y7FV'">tv_y7fv.png</xsl:when>
		<xsl:when test="contains(/details/movie/certification,'12') and $imdb.preferredCountry='UK'">bbfc_12.png</xsl:when>
		<xsl:when test="contains(/details/movie/certification,'12') and $imdb.preferredCountry='Germany'">fsk_12.png</xsl:when>
        <xsl:when test="/details/movie/certification = '12A'">bbfc_12a.png</xsl:when>
        <xsl:when test="/details/movie/certification = '15'">bbfc_15.png</xsl:when>
		<xsl:when test="/details/movie/certification = '18' and $imdb.preferredCountry='UK'">bbfc_18.png</xsl:when>
		<xsl:when test="/details/movie/certification = '18' and $imdb.preferredCountry='Germany'">fsk_18.png</xsl:when>
		<xsl:when test="/details/movie/certification = '18' and $imdb.preferredCountry='France'">csa_18.png</xsl:when>
        <xsl:when test="/details/movie/certification = 'U' and $imdb.preferredCountry='UK'">bbfc_u.png</xsl:when>
		<xsl:when test="/details/movie/certification = 'U' and $imdb.preferredCountry='France'">csa_0.png</xsl:when>
        <xsl:when test="/details/movie/certification = 'X' and $imdb.preferredCountry='UK'">bbfc_x.png</xsl:when>
		<xsl:when test="/details/movie/certification = 'X' and $imdb.preferredCountry='France'">csa_18.png</xsl:when>
        <xsl:when test="/details/movie/certification = '0' or /details/movie/certification = 'o.Al.'">fsk_0.png</xsl:when>
        <xsl:when test="/details/movie/certification = '6' and $imdb.preferredCountry='Germany'">fsk_6.png</xsl:when>
        <xsl:when test="/details/movie/certification = '16' and $imdb.preferredCountry='Germany'">fsk_16.png</xsl:when>
        <xsl:when test="/details/movie/certification = '12' and $imdb.preferredCountry='France'">csa_12.png</xsl:when>
		<xsl:when test="/details/movie/certification = '16' and $imdb.preferredCountry='France'">csa_16.png</xsl:when>
		<xsl:when test="/details/movie/certification = 'M'">oflc_m.png</xsl:when>
        <xsl:when test="/details/movie/certification = 'MA'">oflc_ma.png</xsl:when>
		<xsl:when test="/details/movie/certification = '-12'">csa_12.png</xsl:when>
		<xsl:when test="/details/movie/certification = '-16'">csa_16.png</xsl:when>
		<xsl:when test="/details/movie/certification = '-18'">csa_18.png</xsl:when>
        <xsl:otherwise>mpaa_nr.png</xsl:otherwise>
	</xsl:choose>
    </xsl:variable>
    <img><xsl:attribute name="src"><xsl:value-of select="concat('pictures/certificates/', $tmp)" /></xsl:attribute></img>
  </xsl:template>
 
  <xsl:template name="studio">
    <xsl:variable name="tmp">
      <xsl:choose>
        <xsl:when test="contains(company,'Fox')">20thcenturyfox.png</xsl:when>
        <xsl:when test="contains(company,'Artisan')">artisan.png</xsl:when>
        <xsl:when test="contains(company,'Carolco')">carolco.png</xsl:when>
        <xsl:when test="contains(company,'Castle Rock')">castlerock.png</xsl:when>
        <xsl:when test="contains(company,'Columbia Pictures')">columbia.png</xsl:when>
        <xsl:when test="contains(company,'Dimension')">dimension.png</xsl:when>
        <xsl:when test="contains(company,'Walt')">disney.png</xsl:when>
        <xsl:when test="contains(company,'DreamWorks')">dreamworks.png</xsl:when>
        <xsl:when test="contains(company,'FilmFour')">filmfour.png</xsl:when>
        <xsl:when test="contains(company,'Gaumont')">gaumont.png</xsl:when>
        <xsl:when test="contains(company,'Hollywood Pictures')">hollywood.png</xsl:when>
        <xsl:when test="contains(company,'Lionsgate')">lionsgate.png</xsl:when>
        <xsl:when test="contains(company,'Lucasfilm')">lucasfilm.png</xsl:when>
        <xsl:when test="contains(company,'MGM')">mgm.png</xsl:when>
        <xsl:when test="contains(company,'Miramax')">miramax.png</xsl:when>
        <xsl:when test="contains(company,'New Line')">newlinecinema.png</xsl:when>
        <xsl:when test="contains(company,'Paramount')">paramount.png</xsl:when>
        <xsl:when test="contains(company,'Revolution Pictures')">revolution.png</xsl:when>
        <xsl:when test="contains(company,'Screen Gems')">screengems.png</xsl:when>
        <xsl:when test="contains(company,'Sony Pictures')">sonypictures.png</xsl:when>
        <xsl:when test="contains(company,'Studio Canal')">studiocanal.png</xsl:when>
        <xsl:when test="contains(company,'Touchstone')">touchstone.png</xsl:when>
        <xsl:when test="contains(company,'TriStar')">tristar.png</xsl:when>
        <xsl:when test="contains(company,'United Artists')">unitedartists.png</xsl:when>
        <xsl:when test="contains(company,'Universal')">universal.png</xsl:when>
        <xsl:when test="contains(company,'Warner')">warner.png</xsl:when>
        <xsl:otherwise>unknownstudio.png</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <img>
      <xsl:attribute name="id">stulistDVD<xsl:value-of select="position()"/></xsl:attribute>
      <xsl:attribute name="src"><xsl:value-of select="concat('pictures/studios/', $tmp)" /></xsl:attribute>
    </img>
  </xsl:template>


  <xsl:template name="network">
    <xsl:variable name="tmp">
      <xsl:choose>
        <xsl:when test="contains(company,'A&#38;E')">tvlogos/ae.png</xsl:when>
        <xsl:when test="contains(company,'ABC')">tvlogos/abc.png</xsl:when>
        <xsl:when test="contains(company,'AMC')">tvlogos/amc.png</xsl:when>
        <xsl:when test="contains(company,'BBC One') or contains(company,'BBC ONE')">tvlogos/bbc1.png</xsl:when>
        <xsl:when test="contains(company,'BBC Two') or contains(company,'BBC TWO')">tvlogos/bbc2.png</xsl:when>
        <xsl:when test="contains(company,'BBC Three') or contains(company,'BBC THREE')">tvlogos/bbc3.png</xsl:when>
        <xsl:when test="contains(company,'BBC Four')">tvlogos/bbc4.png</xsl:when>
        <xsl:when test="contains(company,'BBC')">tvlogos/bbc.png</xsl:when>
        <xsl:when test="contains(company,'Bravo')">tvlogos/bravo.png</xsl:when>
        <xsl:when test="contains(company,'Cartoon Network')">tvlogos/cartoonnetwork.png</xsl:when>
        <xsl:when test="contains(company,'CBS')">tvlogos/cbs.png</xsl:when>
        <xsl:when test="contains(company,'Channel 4')">tvlogos/channel4.png</xsl:when>
        <xsl:when test="contains(company,'The CW')">tvlogos/cw.png</xsl:when>
        <xsl:when test="contains(company,'Discovery')">tvlogos/discovery.png</xsl:when>
        <xsl:when test="contains(company,'Disney')">tvlogos/disney.png</xsl:when>
        <xsl:when test="contains(company,'E!')">tvlogos/e.png</xsl:when>
        <xsl:when test="contains(company,'Five') or contains(company,'five')">tvlogos/five.png</xsl:when>
        <xsl:when test="contains(company,'Food Network')">tvlogos/foodnetwork.png</xsl:when>
        <xsl:when test="contains(company,'FOX')">tvlogos/fox.png</xsl:when>
        <xsl:when test="contains(company,'FX')">tvlogos/fx.png</xsl:when>
        <xsl:when test="contains(company,'HBO')">tvlogos/hbo.png</xsl:when>
        <xsl:when test="contains(company,'History')">tvlogos/historychannel.png</xsl:when>
        <xsl:when test="contains(company,'ITV')">tvlogos/itv.png</xsl:when>
        <xsl:when test="contains(company,'Lifetime')">tvlogos/lifetime.png</xsl:when>
        <xsl:when test="contains(company,'MTV')">tvlogos/mtv.png</xsl:when>
        <xsl:when test="contains(company,'NBC')">tvlogos/nbc.png</xsl:when>
        <xsl:when test="contains(company,'Nickelodeon')">tvlogos/nickelodeon.png</xsl:when>
        <xsl:when test="contains(company,'PBS')">tvlogos/pbs.png</xsl:when>
        <xsl:when test="contains(company,'Showcase') or contains(company,'ShowCase')">tvlogos/showcase.png</xsl:when>
        <xsl:when test="contains(company,'Showtime')">tvlogos/showtime.png</xsl:when>
        <xsl:when test="contains(company,'Spike')">tvlogos/spike.png</xsl:when>
        <xsl:when test="contains(company,'SciFi')">tvlogos/syfy.png</xsl:when>
        <xsl:when test="contains(company,'TBS Japan') or contains(company,'Tokyo Broadcasting System')">tvlogos/tokyobroadcastingsystem.png</xsl:when>
        <xsl:when test="contains(company,'TBS')">tvlogos/tbs.png</xsl:when>
        <xsl:when test="contains(company,'TLC')">tvlogos/tlc.png</xsl:when>
        <xsl:when test="contains(company,'TNT')">tvlogos/tnt.png</xsl:when>
        <xsl:when test="contains(company,'TV Land')">tvlogos/tvland.png</xsl:when>
        <xsl:when test="contains(company,'USA')">tvlogos/usa.png</xsl:when>
        <xsl:when test="contains(company,'UPN')">tvlogos/upn.png</xsl:when>
        <xsl:when test="contains(company,'VH1')">tvlogos/vh1.png</xsl:when>
        <xsl:when test="contains(company,'Comedy Central')">tvlogos/comedycentral.png</xsl:when>
        <xsl:when test="contains(company,'CTV')">tvlogos/ctv.png</xsl:when>
        <xsl:when test="contains(company,'E4')">tvlogos/e4.png</xsl:when>
        <xsl:when test="contains(company,'Rai') or contains(company,'RAI')">tvlogos/rai.png</xsl:when>
        <xsl:when test="contains(company,'Fuji')">tvlogos/fuji.png</xsl:when>
        <xsl:when test="contains(company,'NTV')">tvlogos/ntv.png</xsl:when>
        <xsl:when test="contains(company,'Asahi')">tvlogos/tvasahi.png</xsl:when>
        <xsl:when test="contains(company,'TV Tokyo') or contains(company,'TV TOKYO')">tvlogos/tvtokyo.png</xsl:when>
        <xsl:when test="contains(company,'KTV')">tvlogos/ktv.png</xsl:when>
        <xsl:when test="contains(company,'YTV')">tvlogos/ytv.png</xsl:when>
        <xsl:when test="contains(company,'WOWOW') or contains(company,'Wowow')">tvlogos/wowow.png</xsl:when>
        <xsl:when test="contains(company,'KBS') or contains(company,'KBS2')">tvlogos/kbs.png</xsl:when>
        <xsl:when test="contains(company,'MBC')">tvlogos/mbc.png</xsl:when>
        <xsl:when test="contains(company,'OCN')">tvlogos/ocn.png</xsl:when>
        <xsl:when test="contains(company,'SBS')">tvlogos/sbs.png</xsl:when>
        <xsl:when test="contains(company,'ARD')">tvlogos/ard.png</xsl:when>
        <xsl:when test="contains(company,'WDR')">tvlogos/wdr.png</xsl:when>
        <xsl:when test="contains(company,'NHK')">tvlogos/nhk.png</xsl:when>
        <xsl:otherwise>studios/unknownstudio.png</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <img><xsl:attribute name="src"><xsl:value-of select="concat('pictures/', $tmp)" /></xsl:attribute></img>
  </xsl:template>


  <xsl:template name="videoSourcelist">
    <xsl:variable name="tmp">
      <xsl:choose>
        <xsl:when test="contains(videoSource,'BluRay')">source_bluray.png</xsl:when>
        <xsl:when test="contains(videoSource,'HDDVD')">source_hddvd.png</xsl:when>
        <xsl:when test="contains(videoSource,'DVD')">source_dvd.png</xsl:when>
        <xsl:when test="contains(videoSource,'HDTV')">source_hdtv.png</xsl:when>
        <xsl:when test="contains(videoSource,'CAM')">source_cam.png</xsl:when>
        <xsl:when test="contains(videoSource,'TS')">source_telecine.png</xsl:when>
        <xsl:when test="contains(videoSource,'UNKNOWN')">unknownvideo.png</xsl:when>
        <xsl:otherwise>unknownvideo.png</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <img>
      <xsl:attribute name="id">vidlistDVD<xsl:value-of select="position()"/></xsl:attribute>
      <xsl:attribute name="src"><xsl:value-of select="concat('pictures/flags/', $tmp)" /></xsl:attribute>
    </img>
  </xsl:template>
 
  <xsl:template name="videoCodeclist">
    <xsl:variable name="tmp">
      <xsl:choose>
        <xsl:when test="contains(videoCodec,'AVC') or contains(videoCodec,'avc1')">codec_h264.png</xsl:when>
        <xsl:when test="contains(videoCodec,'XviD')">codec_xvid.png</xsl:when>
        <xsl:when test="contains(videoCodec,'DivX')">codec_divx.png</xsl:when>
        <xsl:when test="contains(videoCodec,'MPEG')">codec_mpeg.png</xsl:when>
        <xsl:when test="contains(videoCodec,'icrosoft') or contains(videoCodec,'MICROSOFT')
            or contains(videoCodec,'VC-1')">codec_ms.png</xsl:when>
        <xsl:otherwise>unknownvideo.png</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <img>
      <xsl:attribute name="id">vidlistDVD<xsl:value-of select="position()"/></xsl:attribute>
      <xsl:attribute name="src"><xsl:value-of select="concat('pictures/flags/', $tmp)" /></xsl:attribute>
    </img>
  </xsl:template>

 <xsl:variable name="aeonversion">v2.10.0509</xsl:variable>
 <xsl:variable name="gtversion">v1.20b</xsl:variable>
 
</xsl:stylesheet>