<?xml version="1.0" encoding="ISO-8859-1"?>

<jsp:root
	xmlns:jsp="http://java.sun.com/JSP/Page"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	xmlns:rbs="http://www.rbs.com.br/core"
	xmlns:t="http://www.rbs.com.br/xparser"
	xmlns:a="http://www.rbs.com.br/actions"
	xmlns:tmp="http://www.clicrbs.com.br/tempo"
	xmlns:esp="http://www.clicrbs.com.br/especiais"
	version="2.0">

	<jsp:directive.page isELIgnored="false" contentType="text/html; charset=ISO-8859-1" />

	<rbs:setHeader name="Surrogate-Control" value='content="ESI/1.0"' />

	<c:set var="oracle.jsp.tags.reuse" value="${false}" />

	<c:set var="uf"			value="${param.uf}" />
	<c:set var="local"		value="${param.local}" />
	<c:set var="section"		value="${param.section}" />
	<c:set var="artid"		value="${param.id}" />

	<c:set var="tab"		value="00080" /> <!-- ? -->
	<c:set var="canalid"		value="83" /> <!-- OK (já criado nos 3 ambientes) -->
	<c:set var="canal_id"		value="${canalid}" />
	<c:set var="chanid"		value="${canalid}" />
	<c:set var="channel"		value="${canalid}" />
	<c:set var="channel_id"		value="${canalid}" />

	<c:set var="idmenurs"		value="493" /> <!-- homologacao: 5672 producao : 493 desenv : 5672 -->
	<c:set var="idmenusc"		value="494" /> <!-- homologacao: 5672 producao : 494 desenv : 5673 -->

	<c:forEach var="cookieVal" items="${cookie}">
		<c:choose>
			<c:when test="${cookieVal.key eq 'olimpiadasTopo'}">
				<c:set var="topo" value="${cookieVal.value.value}" />
			</c:when>
		</c:choose>
	</c:forEach>
	
	<c:choose>
		<c:when test="${topo ne param.topo}">
			<c:set var="topo" value="${param.topo}" />
		</c:when>
	</c:choose>
	
	<c:choose>
		<c:when test="${not empty param.competicao}">
			<c:set var="competicao" value="${param.competicao}" />
		</c:when>
		<c:otherwise>
			<c:set var="competicao" value="Jogos Olímpicos" />
		</c:otherwise>
	</c:choose>
	<c:choose>
		<c:when test="${not empty param.competicaoid}">
			<c:set var="competicaoid" value="${param.competicaoid}" />
		</c:when>
		<c:otherwise>
			<c:set var="competicaoid" value="2" />
		</c:otherwise>
	</c:choose>	
	<c:choose>
		<c:when test="${not empty param.edicao}">
			<c:set var="edicao" value="${param.edicao}" />
		</c:when>
		<c:otherwise>
			<c:set var="edicao"  value="2008" />
		</c:otherwise>
	</c:choose>

	<c:choose>
		<c:when test="${not empty param.capa}">
			<c:set var="congenitid" value="${param.capa}" />
		</c:when>
		<c:otherwise>
			<c:choose>
				<c:when test="${topo eq 'topo:4' or topo eq '4'}">
					<c:set var="congenitid" value="1012" /> <!-- capa ZH prod : 1012 -->
				</c:when>
			  	<c:when test="${topo eq 'topo:6' or topo eq '6'}">
					<c:set var="congenitid" value="1013" /> <!-- capa DC prod : 1013 -->
				</c:when>
				<c:otherwise>
					<c:set var="congenitid" value="980" /> <!-- homologacao: 751 producao : 980 -->
				</c:otherwise>
			</c:choose>
		</c:otherwise>
	</c:choose>
  
  
	<c:choose>
		<c:when test="${not empty param.uf}">
			<c:set var="uf" value="${param.uf}" />
		</c:when>
		<c:otherwise>
			<c:set var="uf" value="1" />
		</c:otherwise>
	</c:choose>
	<c:choose>
		<c:when test="${not empty param.local}">
			<c:set var="local" value="${param.local}" />
		</c:when>
		<c:otherwise>
			<c:set var="local" value="1" />
		</c:otherwise>
	</c:choose>

	<c:choose>
		<c:when test="${uf eq 1}">
			<c:set var="idmenu" value="${idmenurs}" />
		</c:when>
		<c:otherwise>
			<c:set var="idmenu" value="${idmenusc}" />
		</c:otherwise>
	</c:choose>

	<jsp:include page="actions.jspx" />
	<jsp:include page="sections.jspx" />
	
	<c:if test="${empty applicationScope.enclosingTemplate}">
		<c:set var="enclosingTemplate" value="moldura.xsl" scope="application" />
	</c:if>
	
	<c:if test="${empty applicationScope['com.rbs.template.root']}">
		<c:set var="com.rbs.template.root" value="/shared/clicrbs/olimpiada2008/xsl" scope="application" />
	</c:if>

	<c:if test="${empty applicationScope['com.rbs.template.datasource.rootFileFolder']}">
		<c:set var="com.rbs.template.datasource.rootFileFolder" value="/shared/html" scope="application" />
	</c:if>

	<c:set var="action" value="${applicationScope.actions[param.action]}" scope="request" />
	<c:set var="template">
		${requestScope.action.template}
	</c:set>

	<c:set var="source">
		<c:choose>
			<c:when test="${param.action ne 'news'}">
				<c:set var="newsID" value="${fn:split(action.source, ',')}" />
				<c:choose>
					<c:when test="${fn:length(newsID) gt 1}">
						<c:set var="com.rbs.template.fragment.legacymethod" value="${newsID[1]}" />
						${newsID[0]}
					</c:when>
					<c:otherwise>${newsID[0]}</c:otherwise>
				</c:choose>
			</c:when>
			<c:when test="${param.action eq 'news'}">a${param.id}.xml</c:when>
			<c:otherwise>${param.source}</c:otherwise>
		</c:choose>
	</c:set>
	
	<jsp:scriptlet><![CDATA[
		final java.util.Date hoje = new java.util.Date();
		final java.util.Date dataInicio = com.rbs.util.Util.parseDataBR( "08/08/2008" ); // inicio dos jogos
		pageContext.setAttribute("contagemRegressiva", com.rbs.util.Util.diferencaEmDias( dataInicio, hoje ));
	]]></jsp:scriptlet>
	 
	<c:choose>
		<c:when test="${contagemRegressiva lt '0'}"> 
			<c:set var="contagemRegressiva"> contagemRegressiva </c:set> 
		</c:when>
	</c:choose>
	 

	<c:if test="${empty param.action}">
		<c:set var="capaCgit" value="true" />
	</c:if>

	<c:choose>
		<c:when test="${param.xdebug eq 'xml' or empty param.xdebug}">
			<c:choose>
				<c:when test="${capaCgit}">
					<c:import url="http://www.clicrbs.com.br/jsp/cgit_default.jsp">
						<c:param name="uf" value="${uf}" />
						<c:param name="local" value="${local}" />
						<c:param name="id" value="${congenitid}" />
						<c:param name="section" value="${section}" />
						<c:param name="topo" value="${topo}" />
						<c:param name="contagemRegressiva" value="${contagemRegressiva}" />
					</c:import>
				</c:when>
				<c:otherwise>
					<t:parser source="${source}" template="${template}">
						<c:if test="${fn:contains(header['user-agent'], 'MSIE 6.')}">
							<t:output-property name="omit-xml-declaration" value="yes" />
						</c:if>
						<c:set var="com.rbs.xparser.silent" value="${param.silent}" />
						<!-- <t:output-property name="omit-xml-declaration" value="yes" /> -->
						<t:output-property name="method" value="html" />
						<c:choose>
							<c:when test="${not empty param.omit}">
								<t:output-property name="doctype-public" value="" />
								<t:output-property name="doctype-system" value="" />
							</c:when>
							<c:otherwise>
								<t:output-property name="doctype-public" value="-//W3C//DTD XHTML 1.0 Strict//EN" />
								<t:output-property name="doctype-system" value="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" />
							</c:otherwise>
						</c:choose>
					</t:parser>
				</c:otherwise>
			</c:choose>
		</c:when>

		<c:otherwise>
			xdebug: ${param.xdebug}<br />
			template folder: ${applicationScope['com.rbs.template.root']}<br />
			source: ${source}<br />
			template: ${template}<br />
			${action}<br />
			${empty action}<br />
			${fn:length(applicationScope.actions)} <br />
			capa cgit : ${requestScope.capaCgit}<br />
			param  : ${initParam['capa_rs']}
		</c:otherwise>
	</c:choose>
</jsp:root>