﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
    <xsl:output method="xml" indent="yes"/>

    <xsl:template match="/">
        <xsl:variable name="BrandVideoURL" select="VideoDetail/VideoURL"></xsl:variable>
        <xsl:variable name="VideoKeyValue" select="VideoDetail/VideoKeyValue"></xsl:variable>
        <xsl:variable name="BrandID" select="VideoDetail/BrandID"></xsl:variable>
        <xsl:variable name="TemplateURL" select="VideoDetail/TemplateURL"></xsl:variable>
         
        <div id="div_Video">
            <xsl:choose>
                <xsl:when test="$BrandVideoURL = ''">
                    <div align="center" style="margin-top:10px;" id="div_VideoImage">
                        <img src="{$TemplateURL}Web/Images/Video_icon2.png" border="1" height="50" style="text-align:center;"></img>
                    </div>

                </xsl:when>
                <xsl:otherwise>
                    <div align="center" id="div_CoachvideoURL" style="margin-top:10px;">
                        <xsl:choose>
                            <xsl:when test="contains($BrandVideoURL,'youtube')">
                                <div id="divVideoContainer">
                                    <div id="div_VideoImage">
                                        <img src="http://img.youtube.com/vi/{$VideoKeyValue}/1.jpg" class="link"
                                          title="Play Video" onClick="workout_LoadYouTubeVideo('{$VideoKeyValue}','divVideoContainer','Workout');"></img>
                                    </div>
                                    <div style="margin-top:-30px;margin-right:90px;" id="div_PlayButton">
                                        <img class="link" title ="Play Video"
                                             onClick="workout_LoadYouTubeVideo('{$VideoKeyValue}','divVideoContainer','Workout');"
                                             src="{$TemplateURL}/Web/Images/Play_Icon.png" width="30" height="30"></img>
                                    </div>
                                </div>
                            </xsl:when>
                            <xsl:when test ="contains($BrandVideoURL, '.swf')">
                                @Video.Flash(path: "{$VideoURL}",
                                width: "250",
                                height: "200",
                                play: true,
                                loop: true,
                                menu:  false,
                                bgColor: "blue",
                                quality: "autohigh",
                                scale: "exactfit",
                                windowMode: "transparent")
                            </xsl:when>
                            <xsl:when test ="contains($BrandVideoURL, '.wmv')">
                                @Video.MediaPlayer(
                                path: "{$VideoURL}",
                                width: "250",
                                height: "200",
                                autoStart: true,
                                playCount: 1,
                                uiMode:  "min",
                                stretchToFit: true,
                                enableContextMenu: true,
                                mute: false,
                                volume: 75)
                            </xsl:when>
                            <xsl:when test ="contains($BrandVideoURL, '.xap')">
                                @Video.Silverlight(
                                path: "{$VideoURL}",
                                width: "250",
                                height: "200",
                                bgColor: "red",
                                autoUpgrade: true)
                            </xsl:when>
                            <xsl:otherwise>
                                <xsl:value-of select ="$BrandVideoURL"/>
                            </xsl:otherwise>
                        </xsl:choose>
                    </div>
                </xsl:otherwise>
            </xsl:choose>
        </div>
    </xsl:template>
</xsl:stylesheet>
