<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:eat="http://msqr.us/xsd/ieat"
	xmlns:xweb="http://msqr.us/xsd/jaxb-web"
	exclude-result-prefixes="eat xweb">
	
    <!-- imports -->
	<xsl:import href="tmpl/default-layout.xsl"/>
	<xsl:import href="tmpl/util.xsl"/>
	
	<!-- layout variables -->
	<xsl:variable name="layout.global.nav.page" select="''"/>
	
	
	<xsl:template match="xweb:x-data" mode="page-title">
		<xsl:value-of select="key('i18n','add-recipe-to-meal.title')"/>
	</xsl:template>
	
	<!-- no global nav on this view -->
	<xsl:template match="xweb:x-data" mode="page-global-nav"/>
	
	<xsl:template match="xweb:x-data" mode="page-head-content">
		<script type="text/javascript" src="{$web-context}/js/edit-meal.js" xml:space="preserve"> </script>
		<script type="text/javascript" src="{$web-context}/js/xweb-locale.js" xml:space="preserve"> </script>
		<script type="text/javascript" src="{$web-context}/js/ieat-util.js" xml:space="preserve"> </script>
		<script type="text/javascript" xml:space="preserve">
			<xsl:comment>
			var rowNum = <xsl:value-of select="xweb:x-model/eat:search-results/@mode"/>;
			function chooseRecipe(recipeId,recipeName) {
				if ( !window.opener ) {
					alert("No opener!");
					return;
				}
				
				chooseRecipeForMeal(window.opener.document,rowNum,recipeId,recipeName);
				
				window.close();
			}
			//</xsl:comment>
		</script>
	</xsl:template>

	<xsl:template match="xweb:x-data" mode="page-body">
        <div class="intro">
			<xsl:value-of select="key('i18n','add-recipe-to-meal.intro')"/>
        </div>
        
		<xsl:apply-templates select="." mode="search-for-recipes"/>
    </xsl:template>
    
</xsl:stylesheet>
